Hereditary Semiorders and Enumeration of Semiorders by Dimension

In 2010, Bousquet-Mélou et al. defined sequences of nonnegative integers called ascent sequences and showed that the ascent sequences of length n are in oneto-one correspondence with the interval orders, i.e., the posets not containing the poset 2 + 2. Through the use of generating functions, this provided an answer to the longstanding open question of enumerating the (unlabeled) interval orders. A semiorder is an interval order having a representation in which all intervals have the same length. In terms of forbidden subposets, the semiorders exclude 2+2 and 1+3. The number of unlabeled semiorders on n points has long been known to be the nth Catalan number. However, describing the ascent sequences that correspond to the semiorders under the bijection of Bousquet-Mélou et al. has proved difficult. In this paper, we discuss a major part of the difficulty in this area: the ascent sequence corresponding to a semiorder may have an initial subsequence that corresponds to an interval order that is not a semiorder. We define the hereditary semiorders to be those corresponding to an ascent sequence for which every initial subsequence also corresponds to a semiorder. We provide a structural result that characterizes the hereditary semiorders and use this characterization to determine the ordinary generating function for hereditary semiorders. We also use our characterization of hereditary semiorders and the characterization of semiorders of dimension 3 given by Rabinovitch to provide a structural description of the semiorders of dimension at most 2. From this description, we are able to determine the ordinary generating function for the semiorders of dimension at most 2. Mathematics Subject Classifications: 06A07, 05A15 ∗PNNL Information Release: PNNL-SA-130793 the electronic journal of combinatorics 27(1) (2020), #P1.50 1 1 Background and Motivation In this article, we investigate the bijective relationship between interval orders and ascent sequences introduced by Bousquet-Mélou et al. in [2]. In that paper, the authors answered a classic open question by providing an enumeration of interval orders through a bijection with nonnegative sequences of integers known as ascent sequences. The number of semiorders has long been known to be given by the Catalan numbers, but no one has yet given a description of the subclass of ascent sequences associated to the semiorders by the bijection of Bousquet-Mélou et al. in terms of ascents. Most problematic is the fact that it is possible for an ascent sequence to correspond to a semiorder while some initial subsequence of that ascent sequence corresponds to an interval order that is not a semiorder. To address this, we define the class of hereditary semiorders as those for which every initial subsequence of the corresponding ascent sequence corresponds to a semiorder. The hereditary semiorders can also be nicely described in terms of their interval representation, and this structure further allows us to give a characterization of the semiorders of dimension 2 in terms of this structure. Rabinovitch proved in [23] that all semiorders have dimension at most 3. Combined with the work of Kelly in [18] and Trotter and Moore in [28], this led to a characterization of those of dimension 3. Our analysis uses that characterization. With these structural results in hand, we are able to enumerate both the hereditary semiorders and the semiorders of dimension 2. Interval orders, semiorders, and dimension Before proceeding to our discussion of interval orders and semiorders, we require a couple of definitions that apply to all posets. For a poset P = (X,6P ) and x ∈ X, the (open) down set of x, denoted by D(x), is {y ∈ X : y <P x}. Dually, the up set of x, denoted by U(x) is {y ∈ X : y >P x}. For a positive integer n, n denotes the totally ordered poset with n elements. If n and m are positive integers, then n + m denotes the disjoint union of the posets n and m. The posets 2 + 2 and 1 + 3 are depicted in Figure 1.


Background and Motivation
In this article, we investigate the bijective relationship between interval orders and ascent sequences introduced by Bousquet-Mélou et al. in [2]. In that paper, the authors answered a classic open question by providing an enumeration of interval orders through a bijection with nonnegative sequences of integers known as ascent sequences. The number of semiorders has long been known to be given by the Catalan numbers, but no one has yet given a description of the subclass of ascent sequences associated to the semiorders by the bijection of Bousquet-Mélou et al. in terms of ascents. Most problematic is the fact that it is possible for an ascent sequence to correspond to a semiorder while some initial subsequence of that ascent sequence corresponds to an interval order that is not a semiorder. To address this, we define the class of hereditary semiorders as those for which every initial subsequence of the corresponding ascent sequence corresponds to a semiorder. The hereditary semiorders can also be nicely described in terms of their interval representation, and this structure further allows us to give a characterization of the semiorders of dimension 2 in terms of this structure. Rabinovitch proved in [23] that all semiorders have dimension at most 3. Combined with the work of Kelly in [18] and Trotter and Moore in [28], this led to a characterization of those of dimension 3. Our analysis uses that characterization. With these structural results in hand, we are able to enumerate both the hereditary semiorders and the semiorders of dimension 2.

Interval orders, semiorders, and dimension
Before proceeding to our discussion of interval orders and semiorders, we require a couple of definitions that apply to all posets. For a poset P = (X, P ) and x ∈ X, the (open) down set of x, denoted by D(x), is {y ∈ X : y < P x}. Dually, the up set of x, denoted by U (x) is {y ∈ X : y > P x}. For a positive integer n, n denotes the totally ordered poset with n elements. If n and m are positive integers, then n + m denotes the disjoint union of the posets n and m. The posets 2 + 2 and 1 + 3 are depicted in Figure 1. We call a poset P = (X, P ) an interval order provided that for each x ∈ X there exists a closed, bounded interval I(x) = [l(x), r(x)] of R such that x < P y if and only if r(x) < l(y), i.e., the interval of x lies completely to the left of the interval of y. The collection of intervals associated to P is called an interval representation of P (or just a representation). An interval order P is called a semiorder provided that P has an interval representation in which all intervals have the same (typically unit) length. The first appearance of what we today recognize as an interval order is in a paper by Wiener [29]. It wasn't until 1970, however, that the following theorem was established by Fishburn.
2. P does not contain 2 + 2 as a subposet. 3. If x < P y and z < P w, then x < P w or z < P y.
4. The collection of down sets of elements of X is totally ordered by inclusion. 5. The collection of up sets of elements of X is totally ordered by inclusion.
The characterization of semiorders was actually arrived at earlier in the form of a result in mathematical logic by Scott and Suppes.
Theorem 2 (Scott and Suppes [25]). A poset P is a semiorder if and only if P contains neither 2 + 2 nor 1 + 3 as a subposet.
In [13], Greenough not only showed that when P = (X, P ) is an interval order, the number of distinct down sets of elements of X is equal to the number of distinct up sets of elements of X but also gave an algorithm for generating a unique interval representation using the smallest number of endpoints possible. Although they did not discuss it in this manner, the bijection of Bousquet-Mélou et al. between ascent sequences and interval orders (described in the next subsection) gives rise to such a representation, and such a representation will be central to our arguments. Thus, we briefly describe the algorithm and its critical properties here. To produce the representation, list the down sets of elements of X as D 0 D 1 D 2 · · · D t−1 , where t is the number of distinct down sets (and hence up sets). Also list the up sets of elements of X as U 0 U 1 U 2 · · · U t−1 . For x ∈ X, we define I(x) = [i, j] where D(x) = D i and U (x) = U j . Note that this may map distinct elements x, y ∈ X to the same interval, which is allowed by our definition of interval representation. This happens if and only if D(x) = D(y) and U (x) = U (y). In this case, we say that x and y have duplicated holdings. A poset in which no two elements have duplicated holdings is said to have no duplicated holdings, sometimes abbreviated NODH.
In this article, we shall refer to the representation produced by the algorithm described above as the minimal endpoint representation of an interval order P = (X, P ). Because of the manner in which the minimal endpoint representation is created, we know that for each i ∈ {0, . . . , t − 1}, there exist x, y ∈ X such that l(x) = i and r(y) = i. That is, in a minimal endpoint representation, every integer from 0 to t − 1 occurs as both a left endpoint and a right endpoint. Notice that when P is a semiorder, its minimal endpoint representation is not necessarily one in which all intervals have the same length. The most straightforward example of this is 1+2, which is shown in Figure 3 along with its minimal endpoint representation.
x y z x y z While the minimal endpoint representation of a semiorder does not have all intervals of the same length, there is a straightforward interval containment test to determine if a minimal endpoint representation of an interval order is one of a semiorder. We will frequently make use of the following lemma in this paper.
Lemma 4. An interval order P is a semiorder if and only if its minimal endpoint representation does not include intervals [a 1 , b 1 ] and [a 2 , b 2 ] such that a 1 < a 2 and b 2 < b 1 .
the electronic journal of combinatorics 27(1) (2020), #P1.50 Proof. Let P = (X, P ) be an interval order. For the "only if" direction, we consider the contrapositive. The existence of intervals satisfying the conditions in the lemma means that the interval [a 2 , b 2 ] lies in the interior of [a 1 , b 1 ]. Suppose that I(x) = [a 1 , b 1 ] and I(z) = [a 2 , b 2 ]. Since the representation is minimal, we know that there are y, w ∈ X such that r(y) = a 1 and l(w) = b 1 . Then {x, y, z, w} is a 1 + 3 in P , so P is not a semiorder.
For the converse, suppose that P is an interval order that is not a semiorder and let {x, y, z, w} be a 1 + 3 in P with x incomparable to y, z, w and y < z < w. Notice that which shows that I(x) and I(z) are the intervals we seek.
The minimal endpoint representation of an interval order can also be encoded in matrix form. For NODH interval orders, Fishburn called these characteristic matrices in [11]. They have been more recently studied by Dukes and Parviainen in [8]; Dukes et al. in [6]; and Jelínek in [17]. In [17], Jelínek studied the class of what he calls Fishburn matrices that extend to the case where duplicated holdings are allowed. Our Lemma 4 can be recast in terms of matrices as in Proposition 16 of [6]. Because the following work relies on an understanding of the underlying minimal endpoint representation, we choose not to further explore the matrix-based approach here.
If P = (X, P ) is a poset, we say that a total order L on X is a linear extension of P provided that for all x, y ∈ X, if x P y, then x y in L. The dimension of P , denoted dim(P ), is the least d such that there exist linear extensions L 1 , L 2 , . . . , L d of P such that (as sets of ordered pairs) In [1], Bogart et al. showed that for every positive integer d, there exists an interval order having dimension at least d. On the other hand, the situation for semiorders is much more restricted. Rabinovitch showed in [23] that if P is a semiorder, then dim(P ) 3. Furthermore, dim(P ) = 3 if and only if P contains one of the posets shown in Figure 4. Rabinovitch's original version of this result involved a limitation on the height of the semiorder. The independent work of Kelly in [18] and Trotter and Moore in [28] provided a complete characterization of the posets of dimension 3. In light of their results, Rabinovitch's three forbidden subposets for a semiorder to have dimension at most 2 was verified to be complete without limitations as to height, as stated in Corollary 3.3 of Trotter's monograph [26].
For more information on interval orders and semiorders, Fishburn's monograph [11] is a classic while Trotter's survey article [27] provides a more recent look. The canonical work on dimension theory for posets is Trotter's monograph [26]. The labels on the posets in Figure 4 follow Trotter's notation, but we note that there is an error in his list of the forbidden subposets for a semiorder to have dimension at most 2. On page 197, he lists FX 1 in addition to the three given here, but FX 1 is not a semiorder since {b 1 , a 3 , b 2 , c} is a 1 + 3.

Ascent sequences and enumeration
Given a sequence (x 1 , x 2 , . . . , x i ) of integers, the number of ascents in the sequence is defined to be asc(x 1 , . . . , In [2], Bousquet-Mélou et al. defined an ascent sequence to be a sequence (x 1 , . . . , x n ) of nonnegative integers such that x 1 = 0 and x i ∈ [0, 1 + asc(x 1 , . . . , x i−1 )] for all 2 i n. They then defined a map Ψ from (unlabeled) interval orders on n points to ascent sequences of length n and showed that their function is a bijection. Here, we recast the inverse of that bijection as a way to construct the minimal endpoint representation of an interval order on n points from an ascent sequence of length n. The process of constructing the interval order corresponding to an ascent sequence proceeds iteratively through the ascent sequence. The simplest ascent sequence, (0), corresponds to the minimal endpoint representation [0, 0]. To describe the algorithm, we assume that we have an ascent sequence (x 1 , . . . , x n ) with n 2 and have constructed the interval order Q corresponding to the ascent sequence (x 1 , . . . , x n−1 ). We retain some of the notation from [2] by letting (Q) denote the largest right endpoint of an interval in the minimal endpoint representation of Q. We also let * (Q) denote the smallest left endpoint of an interval with right endpoint (Q) (again, in the minimal endpoint representation of Q). Suppose now that x n = i. We obtain the minimal endpoint representation of the interval order P corresponding to (x 1 , . . . , x n ) by applying one of the following three moves: .
the electronic journal of combinatorics 27(1) (2020), #P1.50 We know that the minimal endpoint representation of Q contains [ * (Q) , (Q)], and so Move 1 adds another maximal element to the poset whose interval extends at least as far left as * (Q) so that * (P ) = i. If i = * (Q), then Move 1 merely adds another point to the poset that has [ * (Q) , (Q)] as its interval in the minimal endpoint representation. This gives rise to a pair of points with duplicated holdings. (This use of Move 1 only occurs when i = x n = x n−1 , and this is the only way to create duplicated holdings. We will frequently use this fact in our enumerative work later in the paper.) Move 2 adds a new trivial interval that becomes the unique maximal element in P . Move 3 is the problematic move when it comes to working with semiorders. Its effect is to increase the largest right endpoint by one so that (P ) = (Q) + 1 while inserting a new endpoint at i. Any interval with its left endpoint less than i and its right endpoint at least i has its right endpoint moved one unit to the right. Any interval that had its left endpoint being i or larger is shifted to the right by one unit. Any interval that corresponds to a maximal element in Q (which is equivalent to having right endpoint (Q)) is truncated by retaining its left endpoint but making its right endpoint i. A new interval [i, (Q) + 1] is then inserted, which ensures that the representation is minimal by having i used as both a left and right endpoint. We illustrate Move 3 in Figure 5 with intervals in the representation of Q illustrated above and the corresponding intervals (in the same relative positions) and new interval (shown uppermost) of P below. Example 5. We illustrate the process of constructing the minimal endpoint representation of the interval order corresponding to the ascent sequence (0, 1, 2, 3, 1, 0, 1, 3). We will denote by Q i the interval order corresponding to the first i terms of the given ascent sequence. We know that Move 2, which leads us to Q 4 being represented by {[0, 0], [1,1], [2,2], [3,3]}. We have (Q 4 ) = * (Q 4 ) = 3. Thus, to form Q 5 , we apply Move 1, which adds the interval [1,3], giving the representation illustrated in Figure 6. (At each stage, we place a • above the new interval added at that stage.) We also form Q 6 by using Move 1 and have (Q 6 ) = 3 and * (Q 6 ) = 0. This means that Q 7 must be formed by using Move 3, as depicted in the figure. The interval of length two and the three trivial intervals are shifted right, while the interval [0, 3] is truncated to become [0, 1] and the new interval is [1,4]. This leaves us with (Q 7 ) = 4 and * (Q 7 ) = 1, so finishing requires another Move 3. This Move 3 shifts two intervals, stretches no intervals, and truncates two intervals.
Since the work of Bousquet-Mélou et al., a variety of results building on their work have been published. Many of them relate to pattern-avoiding permutations and specialized classes of ascent sequences. However, it is worth highlighting some of those with connections to posets. For instance, in [20], Kitaev and Remmel enumerated interval orders by number of minimal elements (and other statistics). They also identified a subset of the ascent sequences that they termed the restricted ascent sequences and showed that the number of ascent sequences of length n is enumerated by the n th Catalan number. However, the bijection between ascent sequences and interval orders does not send the restricted ascent sequences to the semiorders, and the authors were unable to characterize the interval orders corresponding to the restricted ascent sequences. They did conjecture a refined version of their generating function for enumeration by number of minimal elements, which was proved independently by Levande in [21] and Yan in [32]. Dukes et al. looked at enumeration by the number of indistinguishable elements in [7], while Khamis enumerated the number of interval orders with no duplicated holdings by height in [19]. The focus of Jelínek's work in [16] was to enumerate the number of self-dual interval orders. Claesson and Linusson looked at connections between various classes of matchings the electronic journal of combinatorics 27(1) (2020), #P1.50 and interval orders in [3]. Disanto et al. looked at some problems involving generating and enumerating series parallel interval orders and semiorders in [5].
As mentioned earlier, the number of semiorders on n points is the n th Catalan number, as shown by Wine and Freund in [31] and Dean and G. Keller in [4]. Greenough showed in [13] that the number of semiorders on n points with no duplicated holdings is given by where the terms of the sums are multinomial coefficients. More recently, Lewis and Zhang were able to enumerate the number of graded posets (not interval orders) that do not contain 1 + 3 in [22], which was followed by the work of Guay-Paquet et al. in [14]. An enumeration of semiorders by length (one less than the number of elements in a maximum chain) was given by Hu in [15]. The only work we are aware of that enumerates any class of posets by dimension is the work of El-Zahar and Sauer in [9], where they provide an asymptotic enumeration of two-dimensional posets. Our work in the remainder of the paper will be restricted to unlabeled semiorders. We will proceed to define what we call the hereditary semiorders and characterize their structure. This structure then gives a way to access the semiorders of dimension 2. Our enumeration will proceed by looking at the ascent sequences corresponding to these classes of semiorders. The sequences of integers produced as a result were not in OEIS prior to this work.

Block Structure of Hereditary Semiorders
It is straightforward to verify that the ascent sequence (0, 1, 0, 1, 2, 0) has minimal endpoint representation as an interval order as shown in Figure 7 under the bijection Ψ −1 of Bousquet-Mélou et al. By Lemma 4, we can tell that this is not a semiorder. Progressing to the ascent sequence (0, 1, 0, 1, 2, 0, 2) requires a Move 3, however, which destroys the 1 + 3, giving us the minimal endpoint representation depicted in Figure 8. Since no interval is contained in the interior of any other interval, we know that this is a semiorder. This dilemma leads us to make the following definition.
Definition 6. Let P be a semiorder on n points, and let (x 1 , . . . , x n ) be the ascent sequence corresponding to P under Ψ. We say that P is hereditary provided that for every i with 1 i n, Ψ −1 ((x 1 , . . . , x i )) is a semiorder. As we will show, the hereditary semiorders have a particularly nice structure in terms of their minimal endpoint representations. We describe this structure as being built from certain fundamental blocks with three types of boundary options for how different blocks can be combined to form a larger hereditary semiorder.
Definition 7. The fundamental blocks we use to characterize the hereditary semiorders are as given below. Throughout, b is a nonnegative integer and k is an integer.
We refer to T 0 as the trivial block. A nontrivial block is any block that is not T 0 . We will occasionally omit the superscript and refer to T 1 if the position of the block is clear from context. If we wish to refer to a generic block of the form W b k , we will use W. For U b k , we will write U, and for C b k we will write C. By B, we will mean a block that could either be a C or a U.
We give sample illustrations of some of the blocks defined in Definition 7 in Figure 9. Our definitions of the blocks is in terms of sets, but we have already discussed the fact that a semiorder with duplicated holdings will have multiple elements associated to the same interval. Because we know how duplicated holdings arise in terms of the ascent sequence, we will be able to disregard such issues in terms of the block structure, stating our results in terms of the intervals appearing in the interval representation and implicitly allowing multiple points of the semiorder to have the same interval associated. We will, however, be able to readily address duplicated holdings when we get to our enumerative results later in the paper.
Next we define ways in which blocks can be combined. Note that the sum of the subscript and superscript on any block gives the largest endpoint of an interval in the block (and the superscript is the smallest endpoint).
by taking the set-theoretic union of the two blocks. The intersection between these two blocks is only the interval We can join two blocks (neither T b 1 and not both W) with a weak boundary, denoted by , we must also allow a weak boundary with optional element (or optional interval ), which we denote by A b Note that weak boundaries are not permitted when one of the blocks is T b 1 , since we would not be left with a minimal endpoint representation. We also do not permit a weak boundary between two W, since such a construction would simply produce a W with larger subscript. From the definitions alone, it is not clear that it is sufficient to define a weak boundary with optional element only in the restricted cases given in Definition 8. However, our argument will show that such a boundary cannot occur elsewhere. The block T 0 exists only to account for the antichain poset in which no two distinct points are comparable to one another, and T 0 cannot be combined with other blocks.
Example 9. In Figure 10, we now illustrate the intervals of a semiorder with block structure Notice that the interval [3,3], which would be present in C 0 3 , is absent because of the weak boundary. The interval [8,8] is also omitted because of a weak boundary. The interval [2,4] that bridges the boundary between the first two blocks is the optional interval.
We are now ready to state and prove our result about the structure of hereditary semiorders.
Theorem 10. If P is a hereditary semiorder, then intervals in the minimal endpoint representation of P can be uniquely described using the blocks of Definition 7 combined with the boundaries of Definition 8. Proof. Our proof is by induction on n, the number of points in P . Since points with duplicated holdings do not impact the intervals in the minimal endpoint representation, we will assume without loss of generality that P has no duplicated holdings. For n = 1, the only option is a single point, which has minimal endpoint representation of the interval [0, 0]. This is T 0 . Now suppose for some positive integer n that if Q is a hereditary semiorder on n points, then Q can be described in terms of blocks and boundaries. Let P be a hereditary semiorder on n + 1 points, and let (x 1 , . . . , x n , x n+1 ) be the corresponding ascent sequence under the bijection Ψ of Bousquet-Mélou et al. Since P is hereditary, we know that Ψ −1 ((x 1 , . . . , x n )) is a semiorder Q on n points. Therefore, by the induction hypothesis, the intervals in the minimal endpoint representation of Q can be described in terms of blocks and boundaries. The proof is by cases based first on the last boundary and block in the block structure of Q and second on the value of α = x n+1 . When the last block is T b 1 (and hence (Q) = * (Q) = b + 1), the last boundary must be strong by definition.
lies in the interior of the new interval added to form P , and so P is not a semiorder by Lemma 4. When α = b, we add the interval [b, b + 1], and thus the last boundary and block changes from |T b 1 to |W b 1 . The case α = b + 1 results in duplicated holdings. Finally, when α = b + 2, a Move 2 is used and the block structure of P ends in |T b 1 |T b+1 1 . Before getting into the details of the other blocks and boundaries, note that when the final block has subscript a and superscript b, taking α = a + b + 1 always results in a Move 2 that adds the trivial interval [b + a + 1, b + a + 1]. This adds |T b+a 1 to the end of the block structure of Q to form the block structure of P . Therefore, we will not consider this situation below.
We now consider when the block structure of Q ends |C b a , which implies * (Q) = b. When α = b, the result is duplicated holdings. When α < b, Move 1 is used, adding the interval [α, a + b]. This places the interval [b, b], which exists because of the strong boundary, in the interior of the new interval, and so P is not a semiorder. When α satisfies b + 1 α a + b, a Move 3 is applied to construct P . For α = b + 1, this converts the |C b a at the end of the block structure of Q into |U b a+1 as depicted in Figure 11. When α satisfies b + 2 α < b + a, the Move 3 results in an interval order that is not a semiorder. This is because Move 3 extends the interval [b, α] in Q to the interval [b, α + 1] in P and truncates the interval [b + 1, a + b] in Q to become the interval [b + 1, α] in P . This results in one interval contained in the interior of another, violating Lemma 4. When α = b + a, the electronic journal of combinatorics 27(1) (2020), #P1.50 no intervals are truncated but the interval [b + a, b + a] becomes [b + a + 1, b + a + 1] and the interval [b + a, b + a + 1] is added. This results in the block structure of P ending C b a W b+a Figure 11: The next case is that the block structure of Q ends |U b a , which means * (Q) = b + 1. When α < b, we use a Move 1, which adds the interval [α, b + a]. This interval contains [b, b + 1] in its interior, and so P would not be a semiorder. For α = b, this adds the interval required to convert the U b a to a C b a while retaining the strong boundary. For α = b + 1, we produce duplicated holdings. The remaining cases involve Move 3. The Because of the definition of U a b , we know that a 3, and thus we must consider α satisfying b + 2 α a + b − 1. Here we again use Lemma 4 by noting that the interval The final case involving a strong boundary before the last block of Q is when Q's block structure ends with |W b a . In this case, , which takes us out of the class of semiorders. For a ∈ {1, 2}, α < b places the interval [b, b] in the interior of [α, b + a], so P would not be a semiorder. Thus, it remains only to consider a 2 and α = b + a − 2. Here, we have a Move 1 that adds the interval [b + a − 2, b + a]. When a = 2, this converts the |W b 2 at the end of the block structure of Q into |C b 2 at the end of the block structure of P . For a > 2, the block structure of P ends |W b a−2 C b+a−2

2
. This is illustrated in Figure 12.
To begin consideration of where the last boundary is weak, we assume that Q's block structure ends C b a . Here * (Q) = b. The Move 1 cases are α b. When α = b, we have the electronic journal of combinatorics 27(1) (2020), #P1.50 duplicated holdings. If α < b, then since a 2 the interval [b, b + a − 1] exists and is contained in the interior of [α, b + a]; therefore, P is not a semiorder. For α = b + 1, the situation is just as with a strong boundary, and the last block of P 's block structure is U b a+1 . When α satisfies b + 2 α a + b, the two possibilities are just as with |C b a . When Q's block structure ends U b a , the argument is identical to the |U b a case. Thus, we proceed to assume that the last boundary and block of Q is W b a , which means that * (Q) = b + a − 1. For a 2 or α b, the situation is just as when the final boundary is strong. Thus, we must only consider when a = 1 and α < b. When α b − 2, we note that the existence of a weak boundary means that the block preceding our W b 1 must be a C or a U, and thus the minimal endpoint representation of Q contains the interval . This interval is contained in the interior of the new interval [α, b + 1], and P is not a semiorder. The final case is α = b − 1, which leads us to the necessity of the optional interval, since the new interval is [b − 1, b + 1]. Thus, the final block and boundary of P 's block structure is o W b 1 . The previous case has forced us now to consider the situation where the final boundary and block of Q is The case α b − 2 creates a nonsemiorder by Lemma 4 as in the case of a weak boundary. For α = b − 1, we have duplicated holdings. It remains only to consider the case α = b. Note that the weak boundary preceding the last block of Q must be preceded by a C or a U. In either case, the interval [b − 2, b] must be present because of the minimum size of such blocks. In P , this interval becomes [b − 2, b + 1], and the optional interval is truncated to . We now have one interval in the interior of another, and so P is not a semiorder by Lemma 4.
We now must consider the case where Q's final boundary and block are o W b 2 , which gives * (Q) = b + 1. Here we have that α = b + a + 1 when α = b + 3. For α = b + 2, we extend the final W to o W b 3 . When α = b + 1, we have duplicated holdings. If α = b, the W at the end of Q's block structure becomes o C b 2 in P . For α b − 1, the new interval is [α, b + 2], which contains in its interior the interval [b, b + 1]. Therefore, P is not a semiorder.
When a 3 and Q's block structure ends o W b a , the argument proceeds as it did with W b a . Thus, the only case we must still address is when the final block and boundary of Q's block structure is o C b 2 . Here * (Q) = b. The case α = b + 3 is taken care of because α = b + a + 1 here. When α = b + 2, this is the same as the α = b + a case for W b a , and we have that the block structure for P ends with . This is illustrated in Figure 13.
, which contains in its interior the interval [b, b + 1] that results from the Move 3 truncating [b, b + 2]. Thus, P is not a semiorder by Lemma 4. When α = b, we have duplicated holdings. When α b − 1, the interval [α, b + 2] contains the interval [b, b + 1] in its interior, violating Lemma 4. Since this case did not require us to permit a weak boundary with optional element before any other types of blocks, our proof of the existence of the block structure is complete.
It remains to show that the block structure of a hereditary semiorder P is unique.
the electronic journal of combinatorics 27(1) (2020), #P1.50 * Figure 13: To do so, we will identify the location and type of each boundary between blocks. Once this is done, the blocks between the boundaries are uniquely defined. To identify the boundaries, we begin by labeling all of the integers between 0 and (P ) as follows: We observe that the definition of t tells us that if t(i) = x, then i is not a boundary. To finish our argument, we will redefine t(i) for those integers i with t(i) = z. We wish to have t(i) = o if and only if i is the location of a weak boundary with optional interval and will define the other integers j for which t(j) = z to have t(j) = x. Let i be the smallest integer in a maximal sequence of consecutive integers with label z. Since a weak boundary with optional interval must be preceded by a U or a C, we know that i cannot be the location of a weak boundary with optional interval. This is because the left endpoint of an optional interval must be the left endpoint of two intervals of the preceding U or C as well as being in the interior of at least one interval of the preceding block. Thus, we let t(i) = x, which then tells us that there is a weak boundary with optional element at i + 1, so we let t(i + 1) = o. If t(i + 2) = z, then we must change t(i + 2) to x, since we cannot have two weak boundaries with optional intervals at consecutive integers. This process continues until no integers in [0, (P )] have label z, which means the boundaries have all been uniquely determined because all decisions are forced.
A careful reading of the preceding proof will show why the definition of a weak boundary with optional element is so restrictive. In particular, the optional interval is only introduced when absolutely necessary, and then the argument proceeds to consider what can develop following an optional interval. The fact that an optional interval can only be preceded by a C or a U comes from the fact that our first optional interval arises in the electronic journal of combinatorics 27(1) (2020), #P1.50 the W b 1 case, which requires a C or U before it because of the prohibition against weak boundaries between Ws. The only other weak boundaries with optional elements arise as a consequence of building up from the o W b 1 case, and thus cannot be preceded by a W either.

Block Characterization of Dimension 2 Semiorders
We are now prepared to use the blocks and boundaries introduced above to provide a characterization of the semiorders of dimension 2, which we will eventually use to enumerate them. We begin with a straightforward lemma that links the moves used to construct an interval order from an ascent sequence to subposet structure. This will be useful in connecting to Rabinovitch's forbidden subposet characterization of the dimension 2 semiorders.
Lemma 11. Let P be a poset. If Q is a subposet of P and P is a poset obtained from P by Move 1 or Move 2, then Q is a subposet of P .
Proof. Since neither Move 1 nor Move 2 changes any of the existing comparabilities in P to form P , P is a subposet of P . Thus, Q is a subposet of P as well.
A full description of the block structure of semiorders of dimension 2 will be accomplished through a few steps. We begin by showing that all semiorders of dimension 2 are hereditary.
Theorem 12. Let P be a semiorder. If P is not hereditary, then dim(P ) = 3.
Proof. Let P be a semiorder on n points and let (x 1 , . . . , x n ) = Ψ(P ) be the ascent sequence corresponding to P . Without loss of generality, we may assume that P has no duplicated holdings. Since P is not hereditary, there is some largest positive integer k < n such that Q = Ψ −1 ((x 1 , . . . , x k )) is not a semiorder. Since we know that Q = Ψ −1 ((x 1 , . . . , x k+1 )) is a semiorder, Q does not contain 1 + 3. However, Q must contain 1 + 3, since Q is an interval order that is not a semiorder. Therefore, by Lemma 11, Q is not obtained from Q by Move 1 or Move 2. We consider the minimal endpoint representation of Q. By Lemma 4, this representation has two intervals [a, b] and [c, d] with [c, d] contained in the interior of [a, b]. Since the Move 3 that obtains Q from Q destroys the 1 + 3, we must have that b = (Q) and a < x k+1 . If x k+1 c, then the minimal endpoint representation of Q contains the interval [c + 1, d + 1] and the interval [x k+1 , b + 1], which implies that Q is not a semiorder by Lemma 4. If x k+1 > d, then the minimal endpoint representation of Q contains the interval [a, x k+1 ], which contains [c, d] in its interior. This would force Q to not be a semiorder. Thus, we must have that x k+1 is an integer with c < x k+1 d, forcing c = d.
Since so f = b. Also note that there must be an interval [g, c]. If g > a, then the minimal endpoint representation of Q contains the interval [g, c] and the interval [a, x k+1 ] with x k+1 > c. This again violates Lemma 4. The structural information we have gleaned so far is depicted in Figure 14. Using what we know about x k+1 , we can draw Figure 15 to reflect intervals that must exist in Q . It is straightforward to verify that these intervals give us the three-dimensional semiorder FX 2 from Figure 4.  Figure 15: Intervals that must exist after eliminating 1 + 3 By assumption, once we have obtained Q from (x 1 , . . . , x k+1 ), each of the posets obtained from (x 1 , . . . , x m ) with m k + 1 is a semiorder. We will show that it is impossible to eliminate all copies of FX 2 subject to this constraint, and thus we must have dim(P ) = 3. To do so, assume that m is such that R = Ψ −1 ((x 1 , . . . , x m )) contains FX 2 and that for all m > m , Ψ −1 ((x 1 , . . . , x m )) does not contain FX 2 . We cannot be as precise about the endpoints as we were above at the first occurrence of FX 2 , but we do have the configuration shown in Figure 16. Note that we do not necessarily have that the endpoints shown as equal (such as r(a 1 ) and l(b 2 )) are equal. Instead, we merely require that the intervals overlap. l(b 1 ), then the only impact of the Move 3 on these seven intervals is stretching or shifting that does not impact their relationship to one another, and thus the FX 2 is not removed. Note that if none of b 1 , c, b 3 is maximal in R, then this copy of FX 2 cannot be removed. If b 1 is maximal in R, then a Move 3 with l(b 1 ) < x m+1 l(b 3 ) truncates b 1 and moves the right endpoint of b 2 's interval one unit right. This places b 1 in the interior of b 2 , violating the requirement that we must obtain a semiorder. (If b 1 is not maximal in R, a Move 3 the electronic journal of combinatorics 27(1) (2020), #P1.50 with x m+1 in this range does not remove the FX 2 .) A Move 3 with x m+1 > r(b 2 ) leaves a FX 2 , either consisting of the same points (possibly with truncated intervals) or with the new interval playing the role of c (and possibly with the intervals for b 1 and b 3 being truncated). A Move 3 with x m+1 satisfying l(b 3 ) < x m+1 r(b 2 ) must truncate at least one of b 1 and b 3 if the FX 2 is to be eliminated. However, then the truncated interval lies in the interior of the stretched interval for b 2 , and the resulting poset would not be a semiorder.
Having shown that we cannot eliminate the last occurence of an FX 2 after the last occurrence of a 1+3, we can therefore conclude that if P is not hereditary, then dim(P ) = 3 as claimed.
We now know that our search for semiorders of dimension at most 2 can be restricted to the hereditary semiorders. Thus, we will proceed to consider the three forbidden subposets of Figure 4 and what restrictions we must place upon the block structure of a hereditary semiorder in order to exclude them.
Lemma 13. Let P be a hereditary semiorder. If P contains FX 2 , then the block structure of P requires an optional interval.
Proof. First note that b 2 is incomparable to a 1 , a 3 , b 1 , and b 3 , but {a 1 , a 3 , b 1 , b 2 , b 3 } is not a 5-element antichain. Therefore, the interval corresponding to b 2 in the minimal endpoint representation of P must have positive length. Since a 3 , b 1 , and b 2 are pairwise incomparable, their intervals must overlap. Let x be an integer in the intersection of the intervals for a 3 , b 1 , and b 2 . Since a 3 < b 3 , we have that x < l(b 3 ). Similarly, r(a 1 ) < x. Thus r(a 1 ), x, and l(b 3 ) are all distinct points in the interval for b 2 . Hence, this interval has length at least 2. If b 2 is an optional interval in the block structure, then we are done. If b 2 is not an optional interval, then since its length is at least 2, it must lie in a C or a U. Furthermore, at least one endpoint of b 2 must be the endpoint of the block containing b 2 . Since b 1 is incomparable to c and b 2 < c, we must have that the interval of b 1 extends to the right of r(b 2 ). Since a 3 is incomparable to a 2 and a 2 < b 2 , we must also have that the interval of a 3 extends to the left of l(b 2 ). Since x lies in both the interval of a 3 and that of b 1 , this forces one of b 1 and a 3 to have its endpoints in two different blocks, and therefore, there must be an optional interval. Lemma 14. Let P be a hereditary semiorder. If P contains H 0 , then the block structure of P requires an optional interval.
Proof. As before, we will assume that we are working with the minimal endpoint representation of P . Since b 2 is incomparable to a 1 , a 2 , c, and d, but a 1 < a 2 , we must have that the length of b 2 's interval is at least 1. Since b 1 < b 2 but b 1 is incomparable to d, we must have l(d) < l(b 2 ). Similarly, since b 2 < b 3 and b 3 is incomparable to c, we must have r(b 2 ) < r(c). Since a 1 < a 2 but both a 1 and a 2 are incomprable to d, we must have that the interval of d extends left of the interval of a 2 . This gives l(a 2 ) r(d). Further, the interval of a 2 must leave room for the interval of a 1 to intersect that of b 2 , which requires l(b 2 ) < l(a 2 ). Combining these inequalities gives l(b 2 ) < l(a 2 ) r(d). We may now the electronic journal of combinatorics 27(1) (2020), #P1.50 conclude that l(b 2 ) lies in the interior of d. By the dual argument, we have that r(b 2 ) lies in the interior of c. By the minimality of the representation, this forces the intervals of c and d to each have length at least 2. If either of these is an optional interval, then we are done. If not, then they cannot belong to a W because of their intervals' lengths. Thus, the endpoints of b 2 lie in the interiors of two different blocks, which is only possible if b 2 is an optional interval.
Lemma 15. If P is a hereditary semiorder containing a C somewhere other than the first or last block, then at least one of the blocks adjacent to the C is T 1 or P contains G 0 .
Proof. Suppose that P is a hereditary semiorder containing C b n with b = 0 and at least one following block. We also assume that neither neighboring block is  Figure 17, form a copy of G 0 in P . Figure 17: A C with neighbors other than T 1 forcing G 0 Lemma 16. If P is a hereditary semiorder and the block structure of P requires an optional interval, then dim(P ) = 3.
Proof. The proof is by straightforward case analysis based on what the blocks on either side of a weak boundary with optional interval can be. Recall that a weak boundary with optional interval must be preceded by a C or a U and must be followed by a W or a C b 2 , which limits the cases required. The cases and which forbidden subposet is produced are listed below. The first case is illustrated in Figure 18. Note that if the C b 2 is followed by a weak boundary, there is some interval from the next block with its left endpoint at b + n that can be used as c. A similar situation applies if the block before the weak boundary is Figure 18: Intervals forming an FX 2 with o C b+n 2 preceded by a weak boundary. Figure 18 is drawn to be general enough to encompass a C or U as the preceding block, and note that some intervals not involved in the FX 2 are omitted.
The third case is illustrated in Figure 19. Again, a weak boundary before the C b 2 is not a problem, since there must be an interval from the previous block with its right endpoint at b. Figure 19 can be readily extended to the left in the style of Figure 18 to cover the second case as well, provided that one turns b 3 into an interval of length 0 (or uses an interval from the next block if the following boundary is weak). The final case is not illustrated, but it is straightforward to verify after noting that the optional interval and the first two intervals of length 1 from the W are b 1 , b 3 , and c (in order by increasing left endpoint).
We are now ready to assemble the preceding results to prove the block characterization of semiorders of dimension at most 2.
Theorem 17. Let P be a semiorder. The dimension of P is at most 2 if and only if all of the following hold: 1. P is hereditary, 2. the block structure of P does not require optional elements, and 3. if the block structure of P contains a C somewhere other than the first or last block, then at least one of the blocks adjacent to the C is T 1 .
Proof. We first assume that P is a semiorder and dim(P ) 2 and will prove that the three statements hold. The first statement is the contrapositive of Theorem 12. The second statement is the contrapositive of Lemma 16. Since dim(P ) 2, P does not contain G 0 , and therefore the third statement follows from Lemma 15.
the electronic journal of combinatorics 27(1) (2020), #P1.50 Now suppose that P is a semiorder for which all three statements hold. We will show that dim(P ) 2. The first two statements and the contrapositives of Lemmas 13 and 14 show that P does not contain FX 2 or H 0 . For a contradiction, we now assume that P has dimension 3. By what we've already shown, this means that P must contain G 0 . We will now show that the third statement must be violated by finding a C with two neighboring blocks that are not T 1 . Since c is incomparable to a 2 , a 3 , b 1 , and b 2 but a 2 < a 3 , we know that the length of c's interval in the minimal endpoint representation must be at least 1. Since there are no duplicated holdings amongst the seven points of G 0 , all intervals must be distinct. Furthermore, since an interval contained in the interior of a W is incomparable to only two other intervals but c is incomparable to 4 points from G 0 , we know that one endpoint of c's interval is on the boundary between two blocks. By duality, we may assume without loss of generality that this endpoint is l(c).
Since a 1 < c and b 1 is incomparable to both c and a 1 , we must have that a 1 and b 1 both lie in a block before the one containing c and that r(b 1 ) = l(c) because there are no optional intervals. Since b 1 has a larger up set than a 2 but is incomparable to a 2 , we know that r(b 1 ) < r(a 2 ). Thus, a 2 belongs to the same block as c and l(c) = l(a 2 ) because of the lack of optional intervals. Since a 2 has a larger up set than c, we know that r(a 2 ) < r(c). Since b 2 is incomparable to a 2 , we can thus conclude that l(b 2 ) < r(c). If r(b 2 ) > r(c), then we know by the lack of optional elements that r(b 2 ) must be the right end of the block containing c, a 2 , and b 2 . Since b 2 < b 3 , this means that b 3 must lie in a subsequent block. We now notice that a 3 is incomparable to b 3 and c, and thus r(b 2 ) lies in the interior of a 3 's interval, which requires that a 3 cross the boundary of a block, contradicting the lack of optional intervals. Thus, we must have r(b 2 ) = r(c) is the right boundary of the block containing c. Since c has both its endpoints on the boundary of its block, we must have that c, a 2 , and b 2 lie in a C. Recognizing that a 3 is incomparable to both c and b 3 and b 1 is incomparable to both c and a 1 shows that neither of the adjacent blocks to the C can be T 1 , and our proof is complete.

Enumeration of Hereditary Semiorders
We are now prepared to use the block structure in order to enumerate the hereditary semiorders. The difficulty in building a generating function to complete this task is that there are restrictions on how the blocks can be combined using the various boundaries. In particular, we recall that a T b 1 may not be combined using a weak boundary, two consecutive W may not be combined using a weak boundary, a W may not be followed by a weak boundary with optional element, and a weak boundary with optional element may only preceed a W or a C b 2 . We will use notation inspired by regular expressions to give a compact way of describing the ways in which blocks are arranged. The components of our notation are +, * , and ?, used as superscripts. A superscript + will denote one or more consecutive occurrences of the entity to which the + is attached. A * means that zero or more consecutive occurrences of the entity are allowed. A ? means that at most one occurrence of the entity is allowed. When a + is used between two strings (rather than a superscript), each pattern is allowed. All of our boundaries will be assumed to be the electronic journal of combinatorics 27(1) (2020), #P1.50 weak unless explicitly shown in the notation. Recall from Definition 7 that we will use B to refer to a block that could be either a C or a U.
We will break up the block structure of a hereditary semiorder based upon the occurrences of strong boundaries and the occurences of weak boundaries with optional intervals. Because a strong boundary is determined based on the presence of an interval of length 0 and such an interval must be present at the left of the first block of a hereditary semiorder and at the right of the last block, we will treat the the two ends of a block structure as if there are strong boundaries there. If we first consider the situation where no weak boundaries with optional intervals are allowed, then it suffices to break the full block structure up into the pieces between strong boundaries. We represent this as X ss = W ? (B + W) * B * . Essentially, between two strong boundaries, we can view the blocks as divided further by the occurrences of the W, which may not be adjacent (since all boundaries inside this string are weak). Between Ws, we must have at least one B. Notice that this structure allows for there to be no blocks between two strong boundaries, which is what creates a T b 1 . We may further repeat the pattern X ss as many times as required, which then introduces strong boundaries into the overall block structure.
When an optional interval is present, we may trace backward from that weak boundary with optional interval until we reach either another weak boundary with optional interval or a strong boundary (including the beginning of the block structure). Thus, we will now describe two further subpatterns, one to cover what can occur between a strong boundary and the first ensuring weak boundary with optional interval (denoted X so ) and the other to cover what occurs between two weak boundaries with optional intervals (denoted X oo ). To construct X so , note that the block before a weak boundary with optional element must be a B, and certainly many of them are permitted, so X so must end with B + . Other than needing to end with a B, this case looks much like X ss , in that we see isolated W with strings of B in between, and an initial W may or may not occur. Thus, X so = W ? (B + W) * B + . When both ends of a string of blocks joined by weak boundaries are weak boundaries with optional intervals, the situation is more complicated. The weak boundary with optional interval may be followed by a W, in which case the structure proceeds just as with X so , since the final block of the pattern must be a B to allow for the trailing weak boundary with optional interval. This means X oo must allow W(B + W) * B + . We may also follow the weak boundary with optional interval with C b 2 . Since this block is itself a B, this could be the end of the pattern, proceeding immediately to another weak boundary with optional interval. If not, we then see the remainder divided up by W, ensuring that the last block before the weak boundary with optional interval is a B. This gives us C b 2 B * (WB + ) * , which combines with the case where the first block after the weak boundary with optional interval is W to give us As we proceed through the block structure, we must eventually reach an occurrence of a weak boundary with optional interval where the next meaningful boundary is a strong boundary (possibly the one at the end of the block structure). Thus, we need a pattern to describe what happens in such a case, which we denote by X os . Again, the weak boundary the electronic journal of combinatorics 27(1) (2020), #P1.50 with optional interval may be followed by a W or a C b 2 . The former case gives rise to W(B + W) * B * , much like in X oo , but here we end with B * because the next boundary is strong, and so we may end with a W. When beginning with a C b 2 , the situation is also analogous to X oo , but we must allow a W at the end, which gives C b 2 B * (WB + ) * W ? . Combining these yields We now have all the pieces necessary to create a pattern that describes the block structure of all hereditary semiorders. We first note that a weak boundary with optional interval may occur in the form X so o X os , or we may place several copies of X oo (with weak boundaries with optional intervals on each side) in between the X so and the X os . This means we will need to see X so o (X oo o ) * X os in the overall pattern. Since there may be multiple strong boundaries before the first weak boundary with optional interval, the overall pattern must begin X * ss . We need another occurrence of X * ss along with the pattern containing weak boundaries with optional intervals in order to allow weak boundaries with optional intervals to be separated by a combination of strong and weak boundaries. Thus, the pattern that accounts for all hereditary semiorders is Note that H allows for the empty pattern, which is how we will account for T 0 when converting this pattern into a generating function. Translation of the +, * , and ? used in our patterns into generating functions is relatively straightforward. For readers unfamiliar with the use of generating functions to enumerate strings or sequences in this manner, a good introduction is provided by Wilf in [30]. If F is a pattern with generating function F (x), then F * has generating function 1/(1 − F (x)), F + has generating function F (x)/(1 − F (x)), and F ? has generating function (1 + F (x)). The other piece that will require attention is the boundaries, but first we will proceed to determine the generating functions for W, U, C, B, and C b 2 , since those are the atomic pieces of the patterns here. (The patterns developed so far do not involve C or U alone, but we will require these when considering the case of dimension at most 2 in the next section.) Because our patterns above are built on the assumption of weak boundaries between blocks unless we specify a strong boundary or weak boundary with optional interval, we will build our generating functions for the blocks by assuming weak boundaries on each end. This then has the effect of making each of our blocks appear to have two fewer intervals in them than they would when occurring in isolation. For example, the smallest C is C b 2 , which has 5 intervals. However, the lowest order term in C(x), the generating function for C, will be x 3 . Throughout the following, we will use F (x) as the generating function for the block or pattern F.
Recall that an interval order has duplicated holdings if and only if two points of the interval order have the same interval in its minimal endpoint representation. Also, the only way to create duplicated holdings in an ascent sequence is to have x i = x i+1 . Thus, the electronic journal of combinatorics 27(1) (2020), #P1.50 we may proceed to think about the blocks on the basis of no duplicated holdings and then form the generating function by allowing repetition of terms in the ascent sequence to allow for duplicated holdings. For conciseness as we do this, we will let f (x) = x/(1 − x) for the remainder of the paper.
When W b k is preceded and followed by a weak boundary, we do not have length 0 intervals to concern ourselves with. The one that would be present at the left with a strong boundary is simply never created, and the one that would be at the right with a strong boundary is created by the ascent sequence from an earlier block and subsequently moved into a later block. Thus, we are concerned with a subsequence of length k when we work without duplicated holdings. The subsequence we must have is b, b + 1, b + 2, b + 3, . . . , b + k − 1, since each move b + i takes the interval of length 0 and shifts it to the right while adding the interval [b + i, b + i + 1]. Since k 1, we know that the subsequence is not empty. Thus, the generating function component we need here (before allowing for duplicated holdings) is f /(1 − f ), since there is only one way to do things. Substituting f (x) for f takes care of duplicated holdings for us, since we may repeat the integers from b to b + k − 1 provided they remain in increasing order and each integer appears at least one time. Therefore, Note that a U must have at least six intervals (and thus at least four must be accounted for in our generating function). Also, the intervals appear in pairs. A U b k following a weak boundary is created by the subsequence b, b + 1, b, b + 1, . . . , b, b + 1, where there are k − 1 appearances of b, b + 1. This is because the b creates an interval with its left endpoint at b and its right endpoint as far right as possible, and then the subsequent b + 1 produces a Move 3 that truncates the interval created at the previous step to end at b + 1 and stretches/shifts the other intervals of the block. Since The situation for C is a slight modification of what we did for U above, since if the subsequence ended with a b instead of a b + 1, we would have the interval that spans the length of the C. Thus, the subsequence correspondint to C b k must start b, b + 1, b and then have k − 2 pairs b + 1, b following it. Since k 2, we have f 3 /(1 − f 2 ) before addressing duplicated holdings. Therefore C(x) = (f (x)) 3 /(1 − (f (x)) 2 ). The generating function of C b 2 , which is required in X oo and X os , is (f (x)) 3 . Since B merely stands for a C or a U, B(x) = U (x) + C(x), which simplifies to (f (x)) 3 /(1 − f (x)).
Assembling the generating function is now a matter of introducing additional factors of f (x) for each strong boundary and each weak boundary with optional element, since we known exactly what number must appear in the ascent sequence to produce the required interval, but we may repeat it as many times as we like to account for duplicated holdings. Therefore, we have the following: the electronic journal of combinatorics 27(1) (2020), #P1.50 After fully substituting, we conclude that this section has proved the following theorem: Theorem 18. The generating function for the number of hereditary semiorders with n points is A table of values and discussion of asymptotics will be deferred to section 6, after we have completed our enumeration of the semiorders of dimension at most 2.

Enumeration of Dimension 2 Semiorders
The previous section has completed much of the work required for the enumeration of the semiorders of dimension at most 2, since we have the necessary components to address each of the block types. However, the rules for combining the blocks in this case are different. On one level, things get simpler, because we no longer are allowed to have weak boundaries with optional elements. However, the third statement of Theorem 17 places significant restrictions on how a C may appear in the block structure of a semiorder of dimension at most 2. We can use this to our advantage, however, since an interior C must have a T b 1 as a neighbor on (at least) one side, which means that interior C must appear adjacent to a strong boundary.
We proceed by considering what can happen between occurrences of T 1 . The first pattern we consider represents when there are no strong boundaries between two appearances of T 1 (other than the strong boundaries necessitated by the T 1 s). We call this pattern A 0 . Because the blocks on either side of A 0 are T 1 , we are allowed the option of a C as the first block of A 0 or as the last block of A 0 , but we may not have a C anywhere else the electronic journal of combinatorics 27(1) (2020), #P1.50 inside A 0 . What appears between these two possible C must be a mix of W and U, all combined by weak boundaries. Thus, the interior must take the form U * (WU + ) * W ? . It is tempting to sandwich this pattern between two C ? and be done, but that would give us two distinct ways of getting a C by itself, which we cannot allow. Thus, our definition is where the · indicates that we do not allow the enclosed portion of the pattern to be empty. (This is readily accomplished in the generating function by subtracting 1 from the factor that would otherwise be present.) Next, we consider what happens when there are strong boundaries that occur between the T 1 s. The argument is essentially the same as before, giving rise to the pattern If we define A = A 0 +A s , then A represents whatever can occur between two non-adjacent T 1 in a semiorder of dimension at most 2. This tells us that the pattern D that represents all semiorders of dimension at most 2 is The conversion to a generating function proceeds as in the previous section, including the introduction of an initial factor of f (x) to account for the interval [0, 0]. Since the pattern D can be empty, this factor will account for T 0 (and duplicated holdings). We do need the generating function to introduce for T + 1 and T * 1 . Because the subsequence required is prescribed and does not involve any repetitive structure, we conclude that the former is f (x)/(1−f (x)), while the latter is 1+(f (x)/(1−f (x))). After fully substituting and simplifying, we can therefore conclude the following theorem.
Theorem 19. The generating function for the number of semiorders of dimension at most 2 with n points is

Conclusion Exact and Asymptotic Values
Recalling that the number of semiorders on n points is the n th Catalan number, we can use SageMath [24] and the generating functions from Theorems 18 and 19 to calculate the number of semiorders on n points, the number of hereditary semiorders on n points, the number of semiorders of dimension at most 2 on n points, and the number of semiorders of dimension 3 on n points. These values are shown in Table 1 = 3  A000108  A293499  A293498  A293501  1  1  1  1  0  2  2  2  2  0  3  5  5  5  0  4  14  14  14  0  5  42  42  42  0  6  132  132  132  0  7  429  428  426  3  8 1 An asymptotic analysis of the coefficients of the rational generating functions derived above is a straightforward application of the techniques of section IV.5 of [12] by Flajolet and Sedgewick. The poles of H(x) are 1 and approximately 0.29646, 11.681, and 0.51131 ± 0.16533i. Thus, the number of hereditary semiorders on n points is asymptotically 0.08346 · 3.373133 n . The poles of D(x) are approximately 0.311065, 5.60822, 0.456557 ± 0.123792i, 0.536649 ± 0.24759i, and 0.761438 ± 0.68404i. Thus, the number of semiorders of dimension at most 2 on n points is asymptotically 0.12958 · 3.2148 n . For comparison, recall that the Catalan numbers are asymptotically 4 n /(n 3/2 √ π).

No Duplicated Holdings
As discussed in the arguments that led to Theorems 18 and 19, we use f (x) = x/(1 − x) in the construction of the generating functions to allow for consecutive appearances of an integer in the ascent sequences and therefore duplicated holdings in the poset. If, instead, the electronic journal of combinatorics 27(1) (2020), #P1.50 we write those generating functions in terms of the variable f (replacing any explicit occurrence of f (x) by f ), we then have the following corollary.
Corollary 20. The ordinary generating functions for the number of hereditary semiorders with no duplicated holdings (H N (f )) and the number of semiorders of dimension at most 2 with no duplicated holdings (D N (f )) are

Restricted Ascent Sequences
As mentioned in the introduction, Kitaev and Remmel showed in [20] that the Catalan numbers enumerate a nicely-defined subset of ascent sequences. They called an ascent sequence (x 1 , . . . , x n ) a restricted ascent sequences if x 1 = 0 and for all i with 2 i n, m−1 x i 1+asc((x 1 , . . . , x i−1 )), where m is the largest term in (x 1 , . . . , x i−1 ). However, they also showed that the restricted ascent sequences do not correspond to the semiorders under the bijection Ψ. The ascent sequence (0, 1, 0, 1, 2, 0, 2) of Figure 8 corresponds to a semiorder, but the ascent sequence is not restricted. The sequence (0, 1, 0, 1, 0, 1, 2) is a restricted ascent sequence, but it is easy to verify that it does not correspond to a semiorder. While we are not able at this time to fully characterize the interval orders corresponding to restricted ascent sequences, we do have the following theorem as fairly direct consequence of our earlier work.
Theorem 21. Let P be a semiorder and (x 1 , . . . , x n ) = Ψ(P ) the corresponding ascent sequence. The sequence (x 1 , . . . , x n ) is a restricted ascent sequence if and only if P is hereditary.
Proof. When P is hereditary, the fact that (x 1 , . . . , x n ) is a restricted ascent sequence follows primarily from the proof of the block structure in Theorem 10 and the proof of the enumeration of hereditary semiorders in Theorem 18. We have given the values of * (Q i ), where Q i = Ψ −1 ((x 1 , . . . , x i )) in the proof of Theorem 10. Using the proof of Theorem 18, It is straightforward to verify that if the last block is T b 1 , C b a , or U b a , then the maximum value m in the ascent sequence is b + 1. If the last block is W b a and a > 1, then m = b + a − 1. If the last block is W b 1 , then m = b + 1 if the preceding boundary is strong and m = b if the preceding boundary is weak. Since the only time we can add an interval that extends to the left of b in a hereditary semiorder in any of these cases is when the last block is W b 1 and we are adding the optional interval, we thus can see by induction that (x 1 , . . . , x n ) is a restricted ascent sequence.
For the converse, we consider a minimal counterexample. That is, we assume that (x 1 , . . . , x n ) is a restricted ascent sequence corresponding to a semiorder but that it is not the electronic journal of combinatorics 27(1) (2020), #P1.50 hereditary. Hence there is an integer k < n such that for all i k, Q i = Ψ −1 ((x 1 , . . . , x i )) is a semiorder but Q k+1 = Ψ −1 ((x 1 , . . . , x k+1 )) is not a semiorder. By what we have assumed, we know that Q k is a hereditary semiorder. Therefore, Theorem 10 describes its block structure. If the last block is T b 1 , C b a , or U b a , then max i : 1 i k x i = b + 1. Thus, x k+1 b, since we are working with a restricted ascent sequence. If x k+1 = b, then Move 1 is used, which cannot create a 1 + 3 here. From the proof of Theorem 10, we also know that if x k+1 ∈ {b + 1, b + a, b + a + 1}, then Q k+1 is a semiorder. This leaves us to consider a 3, b + 2 x k+1 < b + a, and the last block U b a or C b a . Here, the Move 3 leaves us with [b + 1, b + 2] in the interior of [b, b + a], which results from stretching [b, b + a − 1]. Since neither of these intervals reaches to the largest right endpoint of the minimal endpoint representation, this containment relationship cannot be changed, and Ψ −1 ((x 1 , . . . , x n )) cannot correspond to a semiorder. When the last block is W b a with a > 1, then the fact that m = b+a−1 prevents us from adding an interval that contains another in its interior. When the block structure of Q k ends |W b 1 , we have that m = b + 1, and thus we cannot add an interval creating a 1 + 3. When the block structure of Q k ends with W b 1 preceded by a weak boundary (with or without optional interval), m = b. The largest interval we can thus add, given we have a restricted ascent sequence, is [b − 1, b + 1], which does not create a 1 + 3 because the interval [b, b] is not present. Therefore, a counterexample cannot exist, and our proof is complete.

Open Questions
We close with some possible interesting directions for future work. One would be to consider other classes of combinatorial objects equinumerous to interval orders and ascent sequences to see if there is another natural way to construct a bijection between interval orders and ascent sequences in such a way that every initial subsequence of an ascent sequence corresponding to a semiorder is one that also corresponds to a semiorder. Put another way, can we find a bijection Φ from interval orders to ascent sequences so that replacing Ψ by Φ in Definition 6 leads to all semiorders being hereditary?
Theorem 21 shows that the restricted ascent sequences defined by Kitaev and Remmel in [20] that correspond to semiorders give rise to precisely the hereditary semiorders.
We have left open the question of characterizing all interval orders that correspond to restricted ascent sequences.
Another direction of interest would be to discover more enumerative results involving more global poset statistics. Most of the recent restricted enumeration results focus on statistics that do not appear frequently in the poset literature. (The exceptions being the work of Khamis in [19] and Hu in [15], where height was the driving statistic.) Given an interval representation, the width of an interval order is easy to calculate. An enumeration of interval orders (or semiorders) by width would be of interest. Dimension would be another natural parameter to attempt enumeration by, but since the dimension of interval orders is unbounded, the problem is likely very hard.