Generalized forbidden subposet problems

A subfamily $\{F_1,F_2,\dots,F_{|P|}\}\subseteq {\cal F}$ of sets is a copy of a poset $P$ in ${\cal F}$ if there exists a bijection $\phi:P\rightarrow \{F_1,F_2,\dots,F_{|P|}\}$ such that whenever $x \le_P x'$ holds, then so does $\phi(x)\subseteq \phi(x')$. For a family ${\cal F}$ of sets, let $c(P,{\cal F})$ denote the number of copies of $P$ in ${\cal F}$, and we say that ${\cal F}$ is $P$-free if $c(P,{\cal F})=0$ holds. For any two posets $P,Q$ let us denote by $La(n,P,Q)$ the maximum number of copies of $Q$ over all $P$-free families ${\cal F} \subseteq 2^{[n]}$, i.e. $\max\{c(Q,{\cal F}): {\cal F} \subseteq 2^{[n]}, c(P,{\cal F})=0 \}$. This generalizes the well-studied parameter $La(n,P)=La(n,P,P_1)$ where $P_1$ is the one element poset. The quantity $La(n,P)$ has been determined (precisely or asymptotically) for many posets $P$, and in all known cases an asymptotically best construction can be obtained by taking as many middle levels as possible without creating a copy of $P$. In this paper we consider the first instances of the problem of determining $La(n,P,Q)$. We find its value when $P$ and $Q$ are small posets, like chains, forks, the $N$ poset and diamonds. Already these special cases show that the extremal families are completely different from those in the original $P$-free cases: sometimes not middle or consecutive levels maximize $La(n,P,Q)$ and sometimes no asymptotically extremal family is the union of levels. Finally, we determine the maximum number of copies of complete multi-level posets in $k$-Sperner families. The main tools for this are the profile polytope method and two extremal set system problems that are of independent interest: we maximize the number of $r$-tuples $A_1,A_2,\dots, A_r \in {\cal A}$ over all antichains ${\cal A}\subseteq 2^{[n]}$ such that (i) $\cap_{i=1}^rA_i=\emptyset$, (ii) $\cap_{i=1}^rA_i=\emptyset$ and $\cup_{i=1}^rA_i=[n]$.


Introduction
The very first theorem of extremal finite set theory is due to Sperner [22] and states that if F is a family of subsets of [n] = {1, 2, . . . , n} such that no two sets in F are in inclusion, then |F| ≤ n n/2 holds, and equality is achieved if and only if F consists of all the n/2 -element or all the n/2 -element subsets of [n]. Families consisting of all the k-element subsets of [n] are called (full) levels and we introduce the notation [n] k = {F ⊆ [n] : |F | = k} for them. Sperner's theorem was generalized by Erdős [5] to the case when F is not allowed to contain k + 1 mutually inclusive sets, i.e. a (k + 1)-chain. He showed that among such families the ones consisting of k middle levels are the largest. In the early eighties, Katona and Tarján [18] introduced a generalization of the problem and started to consider determining the size of the largest family of subsets of [n] that does not contain a configuration defined by inclusions. Such problems are known as forbidden subposet problems and are widely studied (see the recent survey [12]).
In this paper, we propose even further generalizations: we are interested in the maximum number of copies of a given configuration Q in families that do not contain a forbidden subposet P . Before giving the precise definitions, let us mention that similar problems were studied by Alon and Shikhelman [1] in the context of graphs when they considered the problem of finding the most number of copies of a graph T that an H-free graph can contain.
Definition. Let P be an arbitrary poset and F a family of sets. We say that G ⊆ F is a copy of P in F if there exists a bijection φ : P → G such that whenever x ≤ P x holds, then so does φ(x) ⊆ φ(x ). Let c(P, F) denote the number of copies of P in F and for any pair of posets P, Q, let us define La(n, P, Q) = max{c(Q, F) : F ⊆ 2 [n] , c(P, F) = 0}, and for families of posets P, Q let us define La(n, P, Q) = max Q∈Q c(Q, F) : F ⊆ 2 [n] , ∀P ∈ P c(P, F) = 0 .
We denote by P k the chain of length k, i.e. the completely ordered poset on k elements. In particular, P 1 is the poset with one element. Let us state Erdős's above mentioned result with our notation.
Theorem 1.1 (Sperner [22] for k = 1, Erdős [5] for general k). For every positive integer k the following holds: The area of forbidden subposet problems deals with determining La(n, P ) = La(n, P, P 1 ) the maximum size of a P -free family. There are not many results in the literature where other posets are counted. Katona [16] determined the maximum number of 2-chains (copies of P 2 ) in a 2-Sperner (P 3 -free) family F ⊆ 2 [n] . This was reproved in [21] and generalized by Gerbner and Patkós in [11].
Theorem 1. 2 ([11]). For any l > k the quantity La(n, P l , P k ) is attained for some family F that is the union of l − 1 levels. Moreover, La(n, P k+1 , P k ) = n i k · i k i k−1 · · · · · i 2 i 1 , where i 1 < i 2 < · · · < i k < n are chosen arbitrarily such that the values i 1 , i 2 −i 1 , i 3 −i 2 , . . . , i k −i k−1 , n−i k differ by at most one.
In this paper, we address the first non-chain instances of the general problem. We will consider the following posets (see Figure 1): let r denote the poset on r + 1 elements 0, a 1 , a 2 , . . . , a r with 0 ≤ a i for all i = 1, 2, . . . , r and we write for 2 . Similarly, let r denote the poset on r + 1 elements a 1 , a 2 , . . . , a r , 1 with a i ≤ 1 for all i = 1, 2, . . . A family that does not contain P 2 is called an antichain. A family F that does not contain P k can be easily partitioned into k − 1 antichains F 1 , . . . , F k−1 the following way: let F i be the set of minimal elements of F \ ∪ i−1 j=1 F j . We call this the canonical partition of F. Our first theorem relies on some easy observations. Theorem 1.3. (a) La(n, , P 2 ) = La(n, , P 2 ) = n n/2 .
The proof of our next theorem uses the notion of profile vectors (ordinary and l-chain profile vectors). Here and throughout the paper h(x) denotes the binary entropy function, Let us return for a moment to the original forbidden subposet problems. The main conjecture of the area was first published by Griggs and Lu in [13].
Conjecture 1.5. For a poset P let us denote by e(P ) the largest integer m such that for any n, any family F ⊆ 2 [n] consisting of m consecutive levels is P -free. Then lim n La(n, P, P 1 ) n n/2 = e(P )

holds.
In words, Conjecture 1.5 states that to obtain an asymptotically largest P -free family F ⊆ 2 [n] one has to consider as many middle levels of 2 [n] as possible without creating a copy of P . Again, we refer the interested Reader to the recent survey [12] to see for which families of posets Conjecture 1.5 has been verified.
However, already Theorem 1.2 shows that to make Conjecture 1.5 valid in the more general context one has to remove at least the word consecutive. All parts of both Theorem 1.3 and Theorem 1.4 suggest that a general conjecture stating that for any pair P, Q of posets La(n, P, Q) is asymptotically attained at a sequence of families consisting of full levels of 2 [n] . But this is not the case at all! There are pairs of posets for which all families consisting of full levels are very far from being optimal. Let us consider La(n, D 2 , P 3 ) the maximum number of 3-chains in diamond-free families. Every family that contains at least three full levels of 2 [n] contains a copy of D 2 , while a family that is the union of at most two levels, does not contain any copy of P 3 . Therefore, if F is D 2 -free and is the union of full levels, then c(P 3 , F) = 0, while there are D 2 -free families with lots of copies of P 3 . Note that D 2 is the smallest poset for which Conjecture 1.5 has not been proved.
Theorem 1.6. For the generalized diamond posets and integers k > l the following holds: Note that Theorem 1.6 implies La(n, D k , D l ) = θ k,l (La(n, P 3 , P 2 )) for any fixed k and l and the exact value of La(n, P 3 , P 2 ) is given by Theorem 1.2. So it is a natural question whether the limit d k,l = lim ∞ La(n,D k ,D l ) La(n,P 3 ,P 2 ) exists and if so, what its value is. In the simplest case k = 2, l = 1 the above inequalities and Theorem 1.2 imply 1/3 ≤ d 2,1 ≤ 1.
So what can be saved from Conjecture 1.5 in the more general context? Let l(P ) be the height of a poset P , i.e. the length of the longest chain in P . Clearly, if F is the union of any l(P ) − 1 full levels, it must be P -free. On the other hand if F n = ∪ l(Q) j=1

[n]
i j is the union of l(Q) full levels with i j+1 − i j ≥ cn for some constant c for all j = 1, 2, . . . l(Q) − 1, then F n contains many copies of Q. Therefore we propose the following.
Conjecture 1.7. For any pair P, Q of posets with l(P ) > l(Q) there exist a sequence of P -free families F n ⊆ 2 [n] all of which are unions of full levels such that La(n, P, Q) = (1 + o(1))c(Q, F n )

holds.
As we have already seen, this conjecture often holds even if l(P ) ≤ l(Q). We say that for a pair P, Q of posets Conjecture 1.7 strongly holds if for large enough n we have La(n, P, Q) = c(Q, F n ) and almost holds if La(n, P, Q) = O(n k c(Q, F n )) for some k that depends only on P and Q. In both cases we also assume the family F n is P -free and is the union of full levels, but we do not assume anything about l(P ) and l(Q). Parts (a) (c), and (d) of Theorem 1. 3 show that Conjecture 1.7 strongly holds for those pairs of posets.
In Theorem 1.3 and Theorem 1.4 we dealt with La(n, P l(Q)+1 , Q) for different posets Q. (In the case of La(n, B, D r ) it is implicit, as the B-free property implies P 4 -free property.) We knew the place of every element of every copy of Q in the canonical partition. In the following we deal with these kind of problems. We introduce the following binary operations of posets: for any pair Q 1 , Q 2 of posets we define Q 1 ⊗ r Q 2 by adding an antichain of size r between Q 1 and Q 2 . More precisely, let us assume Q 1 consists of q 1 1 , . . . , q 1 a and Q 2 consists of q 2 1 , . . . , q 2 b . Then R = Q 1 ⊗ r Q 2 consists of q 1 1 , . . . , q 1 a , m 1 , m 2 , . . . , m r , q 2 1 , . . . q 2 b . We have q 1 i < R q 1 j if and only if q 1 i < Q 1 q 1 j and similarly q 2 i < R q 2 j if and only if q 2 i < Q 2 q 2 j . Also we have q 1 i < R m k < R q 2 j for every i, k, and j. Finally, the m k 's form an antichain. Note that l(Q 1 ⊗ r Q 2 ) = l(Q 1 ) + l(Q 2 ) + 1. Let Q ⊕ r denote the poset Q ⊗ r 0, where 0 is the empty poset, i.e. Q ⊕ r is obtained from Q by adding r elements that form an antichain and that are all larger than all elements of Q. Similar operations of posets were considered first in the area of forbidden subposet problems by Burcsi and Nagy [3].
We will obtain bounds on La(n, P l(Q 1 ⊗rQ 2 )+1 , Q 1 ⊗ r Q 2 ) involving bounds on La(n, P l(Q 1 )+1 , Q 1 ) and La(n, P l(Q 2 )+1 , Q 2 ). For this we will need the following auxiliary statement that can be of independent interest.
The reason for the strange indices is that we will prove a somewhat more general result in Section 4. The r = 2 part of Theorem 1.8 (a) was proved by Bollobás [2]. Theorem 1.9. Let Q 1 , Q 2 be two non-empty posets.
Theorem 1.10. Let Q be a non-empty poset.
(a) If r ≥ 2 and n ∈ N, then there exists an i = i(r, n) such that Furthermore, if Conjecture 1.7 almost holds for the pair P l(Q)+1 , Q, then so it does for the pair P l(Q)+2 , Q 1 ⊕ r.
Corollary 1.12. Conjecture 1.7 strongly holds for the pair P s+1 , K r 1 ,r 2 ,...,rs if for every i < s at least one of r i and r i+1 is equal to 1.
Corollary 1.12 does not tell us anything about the set sizes in the family containing the most number of copies of K r 1 ,r 2 ,...,rs . The next theorem gives more insight for an even more special case.
The rest of the paper is organized as follows: we prove Theorem 1.6 and Theorem 1.3 in Section 2. We explain the profile polytope method and prove Theorem 1.4 in Section 3. Theorem 1.8, Theorem 1.9, Theorem 1.10, and their corollaries are proved in Section 4, while Section 5 contains some concluding remarks.
2 Proofs of Theorem 1.6 and Theorem 1.3 Proof of Theorem 1.6. We start by proving the upper bound. Let F ⊆ 2 [n] be a D k -free family. As for any poset P the canonical partition of a P -free family can consist of at most |P | − 1 subfamilies, we can assume that the canonical partition of F is ∪ k+1 i=1 F i . In any copy of D l in F, the sets corresponding to the top and bottom element of D l come from F i and F j with i − j ≥ 2. The number of such pairs of indices is k+1 2 − k. Let us bound the number of copies of D l with top element from F i and bottom element from F j . As F i ∪ F j is P 3 -free, there are at most La(n, P 3 , P 2 ) many ways to choose the top and the bottom elements F B ⊂ F T . As F is D k -free there can be at most k − 1 sets in F lying between F B and F T , so the number of copies of D l with F B , F T being top and bottom is at most k−1 l . The upper bound on La(n, D k , D l ) follows.
For the lower bound we need a construction.
. Indeed, every set G ∈ G is contained in a set F k+1 ∈ F k+1 and contains a set F 1 ∈ F 1 , therefore if there was a copy of D k , we could assume that its bottom element is from F 1 and its top element is from F k+1 . But any F k+1 ∈ F k+1 contains exactly one element from each F i where i = 2, 3, . . . , k, so there is no space for a copy of D k . On the other hand, for every pair to form a copy of D l . For each such pair we will obtain k−1 l such copies.
Proof of Theorem 1.3. To prove (a), by symmetry, it is enough to show La(n, , P 2 ) = n n/2 . Consider any -free family F ⊆ 2 [n] and its canonical partition F 1 ∪ F 2 . By the -free property of F, elements of F 1 are contained in at most one copy of P 2 . Also, as the -free property implies the P 3 -free property, every copy of P 2 in F must contain a set from F 1 . Sperner's theorem yields c(P 2 , F) ≤ |F 1 | ≤ n n/2 . On the other hand F := {F ⊆ [n] : |F | = n/2 } ∪ {[n]} is -free and every n/2 -element set forms a copy of We continue with proving (b). We will need the following definition. For any family F, the comparability graph of F has vertex set F and two sets F, F ∈ F are joined by an edge if F ⊆ F or F ⊆ F holds. The connected components of the comparability graph of F are said to be the components of F. If a family F is both -free and -free, then its components are either isolated vertices or isolated edges in the comparability graph. Therefore c(P 2 , F) is the number of components that are isolated edges. It follows that La(n, { , }, where the result in the last equation was proved by Katona and Tarján [18]. The construction (given also in [18] (n−1)/2 } shows that the above upper bound can be attained.
To prove (c), let us consider a B-free family F ⊆ 2 [n] and let M = {M ∈ F : ∃F , F ∈ F such that F M F }. As B-free implies P 4 -free, we obtain that M is an antichain, thus |M| ≤ shows that this upper bound can be attained.
To prove (d), by symmetry, it is enough to show La(n, , r ) = ( n n/2 ) r . If F is -free, then it is in particular P 3 -free. Consider its canonical partition. Then a copy of r contains r elements from F 1 and one from F 2 . Moreover, an r-tuple from F 1 may form a copy of r with at most one element from F 2 , otherwise there is a copy (actually r copies) of in F. As F 1 is an antichain, by Theorem 1.1, the upper bound La(n, , r ) ≤ ( n n/2 ) r follows and shows that this can be attained.

The profile polytope method
In this section we prove Theorem 1.4 after introducing the notions of profile vectors and profile polytopes. For a family F ⊆ 2 [n] of sets, let α(F) = (α 0 , α 1 , . . . , α n ) denote the profile vector of F, where α i = |{F ∈ F : |F | = i}|. Many problems in extremal finite set theory ask for the largest size of a family in a class A ⊆ 2 2 [n] . This question is equivalent to determining max F ∈A α(F) · 1, where 1 is the vector of length n + 1 with all entries being 1, and · denotes the scalar product.
More generally, consider a weight function w : {0, 1, . . . , n} → R, and assume we want to maximize w(F) := F ∈F w(|F |). Then this is equivalent to maximizing α(F) · w, where w = (w(0), w(1), . . . , w(n)). As A ⊆ 2 2 [n] holds, we have {α(F) : F ∈ A} ⊆ R n+1 and therefore we can consider its convex hull µ(A) that we call the profile polytope of A. It is well known that any weight function with the above property is maximized by an extreme point of µ(A) (a point that is not a convex combination of other points of µ(A)), moreover if such a weight function is non-negative, then it is maximized by an essential extreme point, i.e. an extreme point which is maximal with respect to the coordinate-wise ordering. First results concerning profile polytopes were obtained in [17,7,8,9,10] and the not too recent monograph of Engel [6] contains a chapter devoted to this topic.
Using this we can determine La(n, P 3 , P 2 ), and using induction with this as the base case one can determine La(n, P k+1 , P k ), but in other cases we will need a more powerful tool than ordinary profile vectors. The notion of l-chain profile vector α l (F) of a family F ⊆ 2 [n] was introduced by Gerbner and Patkós [11] and denotes a vector of length n+1 l . The coordinates are indexed by l-tuples of [0, n] and α l (F)(i 1 , i 2 , . . . , i l ) is the number of one can define the l-chain profile polytope µ l (A), its extreme points and essential extreme points analogously to the above. Note that for l = 1 we get back the definition of the original profile polytope. Let S n,k be the class of all k-Sperner families on [n].
Lemma 3.1 (Gerbner, Patkós, [11]). The essential extreme points of µ l (S n,k ) are the l-chain vectors of k-Sperner families that consist of the union of k full levels.
Let us state the immediate consequence of the above lemma that we will use in our proofs in the remainder of this section.
over all families F ∈ S n,k is attained at some family that consists of k full levels.
Proof of Theorem 1.4. To prove (a) we show La(n, P 3 , r ) = n ir ( ir ir /2 ) r as the other statement follows by symmetry. Let us consider the canonical partition of a P 3 -free family F. Note that a copy of r contains exactly one element F from F 2 and r elements F 1 , F 2 , . . . , F r ∈ F 1 with F i F for all 1, 2, . . . , r. Let us consider a set F ∈ F 2 . The sets of F 1 contained in F form an antichain, thus by Theorem 1.1, their number is at most |F | |F |/2 . Therefore, the number of copies of r that contain when i tends to infinity with n. For constant values of i, the ratio f (i)/f (i + 1) is easily seen to be smaller than 1 (if n is big enough), therefore the maximum of f (i) is attained at i r = (1 + o(1)) 2 r 2 r +1 n as stated. To prove (b) we consider the canonical partition of a P 4 -free family F ⊆ 2 [n] . Any copy of D r in F must contain one set from F 1 , F 3 each and r sets from F 2 . For any F 1 ∈ F 1 , F 3 which implies that i r + j r = n or i r + j r = n − 1 holds.
This implies the maximum of g(i) is attained at i = (1 + o(1)) 1 ·2 r +2 . To prove (c) we again consider the canonical partition of a P 3 -free family F ⊆ 2 [n] . A copy of N in F must contain two sets from F 1 and two from F 2 . Let a, b, c, d be the four elements of N with a ≤ c and b ≤ c, d. For every copy of N in F there is a bijection φ from N to that copy. Then we count the copies of N in F according to the images φ(b), φ(c). Clearly, they form a 2-chain in F, the possible images of d form an antichain among those sets of F 2 that contain φ(b) and the possible images of a form an antichain among those sets of F 1 that are contained by φ(c). Therefore, we obtain where to obtain the last inequality we applied Corollary 3.2 with l = k = 2 and w(i, j) = Note that j = 3n/4 and i = n/4 show the exponent cannot be improved with this method.
To obtain the lower bound consider the P 3 -free families 2 n−i j−i =: g(i, j) (the 1/4-factor is due to the fact that copies of B are counted 4 times as copies of N ). To maximize g(i, j) we first fix j − i and consider g(i + 1, j + 1) It is easy to see that this fraction becomes smaller than 1 when i is roughly n − j + 1. Thus the maximum of g(i, j) is asymptotically achieved when i = n − j. Similarly, we have Therefore, if we write j = (c + o(1))n, we obtain that g is maximized when c 2 (1−c) 4 (2c−1) 6 = 1. After taking the square root of the expression on the left hand side, this is equivalent to that 0 = 7c 3 − 10c 2 + 5c − 1 holds. The solution of this equation is c 0 = 0.69922... As g(n − j, j) = 1 4 n j j n−j 3 = Ω(2 h(j/n)+3 j n h((n−j)/j) /n 2 ), the lower bound follows by plugging in j = 0.69922n.

The ⊗ r operation and copies of complete multi-level posets
In this section we prove results concerning the binary operation Q 1 ⊗ r Q 2 . We introduce two types of profile vectors. For a family F ⊆ 2 [n] of sets, let β r (F) = (β r 0 , β r 1 , . . . , β r n−1 ) denote the r-intersection profile vector of F, where β r i = β r i (F) = |{{F 1 , F 2 , . . . , F r } : F j ∈ F, these are r different sets and | r j=1 F j | = i}|. For a family F ⊆ 2 [n] of sets, let γ r (F) = (γ r 0,1 , γ r 0,2 , . . . , γ r 0,n , γ r 1,2 , . . . , γ r n−1,n ) denote the r-intersection-union profile vector of F, where γ r i,j = γ r i,j (F) = |{{F 1 , . . . , F r } : F 1 , . . . , F r ∈ F, these are r different sets, |F 1 ∩ · · · ∩ F r | = i, |F 1 , ∪ · · · ∪ F r | = j}|. Note that if A ⊆ 2 [n] is an antichain, then γ r i,j (A) > 0 implies j −i ≥ 2, therefore the number of non-zero coordinates in γ r (A) is at most n+1 2 − n = n 2 ≤ n 2 . Let us illustrate with two examples why these profile vectors can be useful in counting copies of different posets. Let F be a P 3 -free and G be a P 4 -free family. We will estimate c(K p,r , F) and c(K p,r,s , G). If we consider the canonical partitions of F = F 1 ∪ F 2 and G = G 1 ∪ G 2 ∪ G 3 , then a copy of K p,r in F contains p sets from F 1 and r sets from F 2 . If we fix F 1 , . . . , F r ∈ F 2 , then the p "bottom" sets of the copies of K p,r in F containing F 1 , . . . , F r form an antichain in {F ∈ F 1 : F ⊆ r j=1 F j }. Therefore, by Theorem 1.1, the number of these copies is at most ( , so summing up for all possible r-tuples of F 2 we obtain c(K p,r , F) ≤ β r (F) · w p and consequently where the jth entry of the vector w p is ( j j/2 ) p . Similarly, if we consider the canonical partition of G = G 1 ∪ G 2 ∪ G 3 , then a copy of K p,r,s in G contains p sets from G 1 , r sets from G 2 and s sets from G 3 . If we fix G 1 , . . . , G r ∈ G 2 , then the bottom p and top s sets of copies of K p,r,s containing G 1 , . . . , G r form antichains in {G ∈ G 1 : G ⊆ r j=1 G j } and {G ∈ G 3 : G ⊇ r j=1 G j }. Therefore, using again Theorem 1.1, we obtain c(K p,r,s , G) ≤ γ r (G 2 ) · w p,s and consequently La(n, P 4 , K p,r,s ) ≤ max{γ r (A) · w p,s : A ⊆ 2 [n] is an antichain}, where the (i, j)th entry of the vector w p,s is ( i i/2 ) p ( n−j (n−j)/2 ) s . Therefore determining the convex hull (and more importantly its extreme points) of the r-intersection profile vectors and r-intersection-union profile vectors of antichains would yield upper bounds on La-functions of complete multi-level posets.
We are not able to determine these convex hulls, we will only obtain upper bounds on the coordinates of these profile vectors. Note that Theorem 1.8 is about special coordinates, so the next two theorems imply that result.
If F is an antichain and r ≥ 3, then γ r i,j (F) ≤ n 2r γ r i,j ( Proof. To see (a), we first consider the special case i = 0, j = n. Observe that γ 2 0,n (F) is the number of complement pairs in F. In an antichain, by Theorem 1.1, this is at most |F|/2 ≤ n n/2 /2. If n is even, then this is achieved when F = [n] n/2 , while the case of odd n was solved by Bollobás [2], who showed that the number of such pairs is at most n−1 n/2 −1 and this is sharp as shown by {F ∈ [n] n/2 To see the general statement observe that for pair I ⊂ J writing F I,J = {F ∈ F : (j+i)/2 . We proceed by induction on r. We postpone the proof of the base case r = 3, and assume the statement holds for r − 1 and any i < j. Let us consider r − 1 sets F 1 , . . . , F r−1 of F and examine which sets can be added to them as F r to get empty intersection and [n] as the union. Let F be the family of those sets. Let A = ∩ r−1 l=1 F l and B = ∪ r−1 l=1 F l with a = |A| and b = |B|. Then members of F contain the complement of B and do not intersect A, and F is Sperner. If we remove B from them, the resulting family is Sperner on an underlying set of size b − a, thus have cardinality at most b−a (b−a)/2 =: w(a, b). Note that we count every r-tuple F 1 , . . . , F r exactly r times. It implies . By induction this is at most n 2 n 2r−2 max a<b γ r−1 a,b ( [n] (a+b)/2 )w(a, b). Let If we fix b − a and consider f (a,b) f (a+1,b+1) = a+1 n−(b−a)−a , we can see that the maximum is taken when b + a = n or b + a = n − 1 depending on the parity of b − a and n.
Let a * , b * be the values for which the above maximum is taken. Note that for any p−n+b * , by counting only those r-tuples where the first r−1 sets have intersection of size a * and union of size b * . (This way we count those r-tuples at most r times). This is exactly f (a * , b * ) if p = n/2 = (a * + b * )/2 , so we obtained rγ r 0,n (F) ≤ n 2r rγ r 0,n ( [n] n/2 ) as required. For r = 3 we similarly consider two members of F and examine which sets can be added to them to get empty intersection and [n] as the union. This leads to (a, b).
Note that if the maximum is taken at a and b with b − a even, then part (a) of the theorem gives γ 2 (a , b ). This essentially lets us use r = 2 as the base case of induction, and finish the proof of this case similarly to the induction step above.
Let us choose a * , b * that maximizes this upper bound with b * −a * = b −a . Similarly to the computation about f (a, b) , we have a * + b * = n or n − 1 depending on the parity of n. Then we obtain 3γ 3 0,n (F) ≤ n 2 γ 2 a * ,b * ( (a +b )/2 ) = 0. But we know by part (a) Similarly to the previous cases, if b − a is fixed, then the maximum of the right hand side is taken for some a * , b * with b * − a * = b − a and a + b = n if n is odd, and a + b = n − 1 or a + b = n + 1 if n is even. Thus we can assume n/2 = (a * + b * − 1)/2. On the other hand, since b * − a * is odd, we have by counting only those triples where two of the sets have intersection of size a * and union of size b * − 1. We can pick first the (b * − 1)-set B and the a * -set A in n

ways, then among {G ∈
[n] (a * +b * )/2 : A ⊂ G ⊂ B} we can pick a pair G 1 , G 2 with G 1 ∩ G 2 = A, (b * −a * −1)/2 /2 ways and then the third set contains the complement of B and does not intersect A. Using that (b) For every r ≥ 3 and i ≤ n there exists j(r, i, n) such that β r i (F) ≤ n 2r+1 β r i ( [n] j(r,i,n) ) holds for any antichain F ⊆ 2 [n] .
Proof. First we prove (a) for the special case i = 0. Let F ⊆ 2 [n] be an antichain, and let F = {F : F ∈ F}, where F = [n] \ F . As F is an antichain, so is F, and thus F ∪ F is P 3 -free. Note that for every pair F 1 , F 2 ∈ F with |F 1 ∩ F 2 | = 0 and F 1 ∪ F 2 = [n], we have two 2-chains F 1 F 2 and F 2 F 1 . Also, every 2-chain in F ∪ F comes from a pair Therefore, if we take the canonical partition of F ∪ F into F 1 ∪ F 2 and introduce the weight function w(F ) = 1 2 |F | |F |/2 if F ∈ F 2 , F / ∈ F 2 and w(F ) = 1/2 if F ∈ F 2 , F ∈ F 2 , then the number of disjoint pairs in F equals F ∈F 2 w(F ). This weight function does not depend only on the size of F , but w (f ) = 1 2 |F | |F |/2 does and obviously w(F ) ≤ w (F ) holds for all F 's. As proved by Katona in Theorem 3 of [16] this weight function is maximized when 2n/3 . As F 2 does not contain complement pairs, it also maximizes w. To see the general statement of (a), we can apply the special case to any I ⊆ [n] and F I = {F \ I : I ⊆ F ∈ F}. We obtain To see (b), let F ⊆ 2 [n] be antichain. Observe where j(r, i, n) = (i + j * )/2 with j * being the value of j that maximizes γ r i,j ( [n] (i+j)/2 ). The penultimate inequality follows from Theorem 4.1.
Proof of Theorem 1.9. Let Q 1 , Q 2 be non-empty posets and let us consider the canonical partition of a P l(Q 1 ⊗rQ 2 )+1 -free family F ⊆ 2 [n] . Then in any copy of Q 1 ⊗ r Q 2 in F, if F 1 , . . . , F r correspond to the r middle elements forming an antichain, we must have F 1 , . . . , F r ∈ F l(Q 1 )+1 . Also, if a copy of Q 1 ⊗ r Q 2 contains F 1 , . . . , F r , then the sets corresponding to the Q 1 part of Q 1 ⊗ r Q 2 must be contained in r l=1 F l , while the sets corresponding to the Q 2 part of Q 1 ⊗ r Q 2 must contain r l=1 F l . Therefore the number of copies of Q 1 ⊗ r Q 2 in F that contain F 1 , . . . , F r is at most La(| r l=1 F l |, P l(Q 1 )+1 , Q 1 )·La(n−| r i=1 F l |, P l(Q 2 )+1 , Q 2 ). We obtained that the total number of copies of Q 1 ⊗ r Q 2 in F is at most (1) If r ≥ 2, then grouping the summands in (1) according to the pair (| r l=1 F l |, | r l=1 F l |) we obtain La(n, P l( where the (i, j)th coordinate of w is La(i, P l(Q 1 ) , Q 1 )·La(n−j, P l(Q 2 )+1 , Q 2 ). Clearly, we have where the last inequality follows from Theorem 4.1. We can calculate γ r i,j ( [n] (i+j)/2 ) by picking the union of size j and the intersection of size i first, which finishes the proof of the upper bound of part (a).
To see the furthermore part suppose that the above maximum is obtained when i takes the value i * and j takes the value j * . We know that there exist two families F 1,i * ⊆ 2 [i * ] and F 2,n−j * ⊆ 2 [n−j * ] , both unions of full levels, integers k 1 , k 2 and constants C 1 , C 2 such that C 1 (i * ) k 1 c(Q 1 , F 1,i * ) ≥ La(i * , P l(Q 1 ) Q 1 ) and C 2 (j * ) k 2 c(Q 2 , F 2,n−j * ) ≥ La(n − j * , P l(Q 2 ) , Q 2 ) hold. Therefore by the upper bound already proven, we know that La(n, P l( . If F 1,i * consists of levels of set sizes h 1 , . . . , h l(Q 1 ) and F 2,n−i * consists of levels of set sizes h 1 , . . . , h l(Q 2 ) , then for the family . Therefore with k = 2r + 2 + k 1 + k 2 the family F shows that Conjecture 1.7 almost holds for the pair P l(Q 1 ⊗rQ 2 )+1 , Q 1 ⊗ r Q 2 .
As the proofs are almost identical we only show the 'strongly holds' case of the furthermore part of (b). Suppose that the above maximum is obtained when i takes the value i * . We know that there exist two families F 1,i * ⊆ 2 [i * ] and F 2,n−i * ⊆ 2 [n−i * ] , both unions of full levels, such that c(Q 1 , F 1,i * ) = La(i * , P l(Q 1 ) Q 1 ) and c(Q 2 , F 2,n−i * ) = La(n − i * , P l(Q 2 ) , Q 2 ) hold. If F 1,i * consists of levels of set sizes j 1 , . . . , j l(Q 1 ) and F 2,n−i * consists of levels of set sizes j 1 , . . . , j l(Q 2 ) , then for the family we have c(Q 1 ⊗ Q 2 , F) = n i * La(i * , P l(Q 1 ) , Q 1 )La(n − i * , P l(Q 2 ) , Q 2 ). Proof of Theorem 1. 10. The proof goes very similarly to the proof of Theorem 1.9. Let us consider the canonical partition of a P l(Q⊗r)+1 -free family F ⊆ 2 [n] . Then in any copy of Q⊗r in F, if F 1 , . . . , F r correspond to the r top elements forming an antichain, we must have F 1 , . . . , F r ∈ F l(Q)+1 . Also, if a copy of Q ⊗ r contains F 1 , . . . , F r , then the sets corresponding to the other elements of the poset must be contained in r l=1 F l . Let j = | r l=1 F l |. Then the number of copies of Q ⊗ r in F that contain F 1 , . . . , F r is at most La(j, P l(Q)+1 , Q). If r ≥ 2, we obtain where the jth coordinate of w is La(j, P l(Q)+1 , Q).
j(r,i,n) )w(i), where the last inequality follows from Theorem 4.2. We have β r i ( [n] j(r,i,n) ) = n i β r 0 ( [n−i] j(r,i,n)−i ) by picking the intersection of size i first.
To see the furthermore part of (a), let i * be the value of i for which the above maximum is attained.
Cn k La(n, i * , Q), therefore F * with C = C and k = 2r + 2 + k shows that Conjecture 1.7 almost holds for the pair P l(Q)+2 , Q ⊕ r.
The proof of the furthermore part of (b) is analogous to the previous ones and is left to the reader.
Proof of Corollary 1.11. We proceed by induction on the number of levels. The base case is guaranteed by Sperner's Theorem 1.1. The inductive step follows by applying Theorem 1.10 as K r 1 ,...,r l = K r 1 ,...,r l−1 ⊕ r l .
Proof of Corollary 1.12. We proceed by induction on the number of levels. The base case is guaranteed by Sperner's Theorem 1.1. Suppose the statement has been proved for all complete multipartite posets satisfying the condition with height smaller than l and consider K r 1 ,r 2 ,...,r l . We know that there exists an i with 1 ≤ i ≤ l such that r i = 1. If 1 < i < l, then the inductive step will follow by applying the furthermore part of Theorem 1.9 to Q 1 = K r 1 ,...,r i−1 and Q 2 = K r i+1 ,...,r l . If i = l, then the inductive step will follow by applying the furthermore part of Theorem 1.10 to Q = K r 1 ,...,r l−1 and r = 1. The case i = 1 follows from c(K r 1 ,...,r l , F) = c(K r l ,..., Proof of Theorem 1. 13. We only give the sketch of the proof as it is very similar to previous ones. Consider a P l+3 -free family F ⊆ 2 [n] and its canonical partition. If l = 1, then we count the number of copies of K r,1,s according to the set F ∈ F 2 that plays the role of the middle element of K r,1,s . The number of copies that contain F is not more than . Let i * be the value of i for which this maximum is attained. Then the family [n] contains exactly that many copies of K r,1,s . If l ≥ 2, then we count the number of copies of K r,1,1,...,1,s according to the sets F 2 ∈ F 2 and F l+1 ∈ F l+1 playing the role of the elements on the second and (l + 1)st level of K r,1,1,...,1,s . For a fixed pair F 2 ∈ F 2 and F l+1 ∈ F l+1 with F 2 ⊂ F l+1 the number of copies of K r,1,1,...,1,s containing F 2 and F l+1 is at most . The value of La(|F l+1 | − |F 2 |, P l−1 , P l−2 ) is given by Theorem 1.2. So we can apply Corollary 3.2 with l = k = 2 and w(i, j) to obtain c(K r,1,1...,1,s , F) ≤ max i,j n j . Let i * and j * be the values of i and j for which this maximum is attained. Then the family consisting of [n] i * /2 , [n] i * , [n] j * , [n] (n+j * )/2 and the l − 2 full levels determined by Theorem 1.2 contains exactly that many copies of K r,1,1,...,1,s .
There are several other complete multi-partite posets for which one can determine the levels that form an almost optimal family. For example, using Theorem 4.2 (a) one can prove that La(n, P 3 , K p,2 ) ≤ nc(K p,2 , F) where F = [n] i ∪ [n] j with i = ( 2 p−1 3+2 p + o(1))n and j = ( 1+2 p 3+2 p + o(1))n. In particular La(n, P 3 , K p,2 ) = 2 (cp+o(1))n , where Let us finish this section by some remarks about K 2,2 = B as there exist several extremal results concerning B. Let us consider the following two posets that contain B: B + and B ++ have five elements a, b, c, d, e such that a < B + c, e and b < B + c, d and also d < B + e, while a, b < B ++ c, d and d < B ++ e. By results of DeBonis, Katona, and Swanepoel [4] and Methuku and Tompkins [20] we know that La(n, B, P 1 ) = La(n, B + , P 1 ) = n n/2 + n n/2 +1 , and as B ++ contains a copy of B + we have La(n, B + , P 1 ) ≤ La(n, B ++ , P 1 ). It is natural to ask how many copies of B can a B + -free or B ++ -free family in 2 [n] contain, especially that the largest B + -free family does not contain any. Obviously, a P 3 -free poset is both B + -free and B ++ -free, therefore we obtain the inequality La(n, P 3 , B) ≤ La(n, B + , B) ≤ La(n, B ++ , B). The next proposition shows that these functions are asymptotically equal. Proof. The first two inequalities are true by definition. Note that La(n, P 3 , B) = 2 (c 2 +o(1))n , where c 2 = 10/7 + h(4/7) + 3h(2/3)/7 by the remarks made after the proof of Theorem 1.13.
Let F ⊆ 2 [n] be B ++ -free, and consider its canonical partition (note that P 5 contains a copy of B ++ , thus F is P 5 -free).
Consider first the family S ⊆ F 2 of sets that appear in 4-chains in F (they must be the second smallest in those chains). Note that if S ∈ S with F 1 S F 3 F 4 , then S is not comparable to any other set F of F as F, F 1 , S, F 3 , F 4 would form a copy of B ++ both if S F or F S. Therefore every set S ∈ S is contained in at most one copy of B in F. As S ⊆ F 2 is an antichain, we obtain c(B, F) − c(B, F \ S) ≤ n n/2 . Clearly, F = F \ S is P 4 -free. Let us consider its canonical partition and denote the resulting antichains by F 1 , F 2 , F 3 . Let S ⊆ F 2 be the family of middle sets of all 3-chains in F . We know that for any S ∈ S there exist F 1 , F 3 ∈ F with F 1 S F 3 . Also, there cannot exist F 1 , F 3 with F 1 S F 3 as then F 1 , F 1 , S, F 3 , F 3 would form a copy of B ++ . So either there is a unique set F that contains S and potentially several sets that are contained in S or there exists a unique F contained in S and several sets containing S. In the former case, if S is contained in a copy of B, it can only be one of the top sets. Furthermore, if a copy of B contains S, then it contains F as otherwise this copy could be extended by F to form a B ++ . As the sets contained in S form an antichain (they are a subfamily of F 1 ), we obtain that the number of copies of B containing S is at most ( } we obtain that the total number of copies containing at least one element of S is at most S∈S w(|S|). By the special case k = l = 1 of Corollary 3.2 we obtain that this expression is maximized over all antichains when S is a full level of 2 [n] .

Remarks
One can define an even more general parameter La R (P, Q). For three posets, R, P and Q we are interested in the maximum number of copies of Q in subposets R of R that do not contain P . Analogously to what we had for set families, we say that R ⊆ R is a copy of Q in R if there exists a bijection φ : Q → R such that whenever x ≤ Q x holds, then so does φ(x) ≤ R φ(x ). Let c(Q, R) denote the number of copies of Q in R and for any three posets R, P and Q we define Note that La(n, P, Q) = La Bn (P, Q), where B n is the poset with elements of 2 [n] ordered by inclusion. Very recently Guo, Chang, Chen, and Li [14] introduced La R (Q, P 1 ), as a general approach to forbidden subposet problems. That is to solve the analogous question in a less complicated structure like the cycle, chain or double chain, and then to apply an averaging argument.
In many parts of Theorem 1.3, the construction yielding the lower bound that matches the upper bound contained the empty set and/or the set [n]. One might wonder whether the La-function remains the same if we do not allow these elements to be included. In other words, if B − n denotes the subposet of B n with ∅ and [n] removed, then how La B − n (∨, P 2 ) relates to La(n, ∨, P 2 ), La B − n (B, P 3 ) to La(n, B, P 3 ) and so on. The { , }-free construction