Supersaturation, counting, and randomness in forbidden subposet problems

In the area of forbidden subposet problems we look for the largest possible size $La(n,P)$ of a family $\mathcal{F}\subseteq 2^{[n]}$ that does not contain a forbidden inclusion pattern described by $P$. The main conjecture of the area states that for any finite poset $P$ there exists an integer $e(P)$ such that $La(n,P)=(e(P)+o(1))\binom{n}{\lfloor n/2\rfloor}$. In this paper, we formulate three strengthenings of this conjecture and prove them for some specific classes of posets. (The parameters $x(P)$ and $d(P)$ are defined in the paper.) $\bullet$ For any finite connected poset $P$ and $\varepsilon>0$, there exists $\delta>0$ and an integer $x(P)$ such that for any $n$ large enough, and $\mathcal{F}\subseteq 2^{[n]}$ of size $(e(P)+\varepsilon)\binom{n}{\lfloor n/2\rfloor}$, $\mathcal{F}$ contains at least $\delta n^{x(P)}\binom{n}{\lfloor n/2\rfloor}$ copies of $P$. $\bullet$ The number of $P$-free families in $2^{[n]}$ is $2^{(e(P)+o(1))\binom{n}{\lfloor n/2\rfloor}}$. $\bullet$ For any finite poset $P$, there exists a positive rational $d(P)$ such that if $p=\omega(n^{-d(P)})$, then the size of the largest $P$-free family in $\mathcal{P}(n,p)$ is $(e(P)+o(1))p\binom{n}{\lfloor n/2\rfloor}$ with high probability.


Introduction
Extremal set theory starts with the seminal result of Sperner [21] that was generalized by Erdős [7] as follows: if a family F ⊆ 2 [n] of sets does not contain a nested sequence F 1 F 2 · · · F k+1 (such nested sequences are called chains of length k + 1 or (k + 1)-chains for short), then its size cannot exceed that of the union of k middle levels of 2 [n] , i.e., |F | ≤ k i=1 n ⌊ n−k 2 ⌋+i . This theorem has many applications and several of its variants have been investigated.
In the early 80's, Katona and Tarján [13] introduced the following general framework to study set families avoiding some fixed inclusion patterns: we say that a subfamily G of F is a (noninduced) copy of a poset (P, ≤) in F , if there exists a bijection i : P → G such that if p, q ∈ P with p ≤ q, then i(p) ⊆ i(q). If i satisfies the property that for p, q ∈ P we have p ≤ q if and only if i(p) ⊆ i(q), then G is called an induced copy of P in F . If F does not contain any (induced) copy of P , the F is said to be (induced) P -free. The largest possible size of a(n induced) P -free family F ⊆ 2 [n] is denoted by La(n, P ) (La * (n, P )). Let P k denote the k-chain, then the result of Erdős mentioned above determines La(n, P k+1 ). These parameters have attracted the attention of many researchers, and there are widely believed conjectures in the area (see Conjecture 1) that appeared first in [3] and [11], giving the asymptotics of La(n, P ) and La * (n, P ).
Let e(P ) denote the maximum integer m such that for any i ≤ n, the family i+m is P -free. Similarly, let e * (P ) denote the maximum integer m such that for any i ≤ n, the family [n] i+1 ∪ [n] i+2 ∪ · · · ∪ [n] i+m is induced P -free. Conjecture 1.
(i) La(n, P ) = (e(P ) + o(1)) n ⌊n/2⌋ . (ii) La * (n, P ) = (e * (P ) + o(1)) n ⌊n/2⌋ . Conjecture 1 has been verified for several classes of posets, but is still open in general. For more results on the La(n, P ) function, see Chapter 7 of [8], and see other chapters for more background on the generalizations considered in this paper.
After determining (the asymptotics of) the extremal size and the structure of the extremal families, one may continue in several directions. Stability results state that all P -free families having almost extremal size must be very similar in structure to the middle e(P ) levels of 2 [n] . Supersaturation problems ask for the minimum number of copies of P that a family F ⊆ 2 [n] of size La(n, P ) + E may contain. This is clearly at least E, but usually one can say much more. Counting problems ask to determine the number of P -free families in 2 [n] . As any subfamily of a P -free family is P -free, therefore the number of P -free families is at least 2 La(n,P ) . The question is how many more such families there are. Finally, one can address random versions of the forbidden subposet problem. Let P(n, p) denote the probability space of all subfamilies of 2 [n] such that for any F ⊆ [n], the probability that F belongs to P(n, p) is p, independently of any other set F ′ . What is the size of the largest P -free subfamily of P(n, p) with high probability 1 ? Clearly, for p = 1, this is La(n, P ). For other values of p, an obvious construction is to take a P -free subfamily of 2 [n] , and then the sets that are in P(n, p) form a P -free family. Taking the e(P ) middle levels shows that the size of the largest P -free family in P(n, P ) is at least p(e(P ) + o(1)) n ⌊n/2⌋ w.h.p.. For what values of p does this formula give the asymptotically correct answer?
In this paper, we will consider supersaturation, counting and random versions of the forbidden subposet problem, mostly focusing on supersaturation results. We will propose three strengthenings of Conjecture 1 and prove them for some classes of posets. In the remainder of the introduction, we state our results and also what was known before.
The supersaturation version of Sperner's problem is to determine the minimum number of pairs F F ′ over all subfamilies of 2 [n] of given size. We say that a family F is centered if it consists of the sets closest to n/2. More precisely, if F ∈ F and ||G| − n/2| < ||F | − n/2| imply G ∈ F . Kleitman [14] proved that among families of cardinality m, centered ones contain the smallest number of copies of P 2 . He conjectured that the same holds for any P k . After several partial results, e.g. [2,5,6], the conjecture was confirmed by Samotij [20]. The following is a consequence of the result of Samotij. We will only use it with k = 2, i.e. the result of Kleitman.
Theorem 2. For any k, t with k − 1 ≤ t and ε > 0 there exists n k,t,ε such that if n ≥ n k,t,ε , then any family F ⊆ 2 [n] of size at least (t + ε) n ⌊n/2⌋ contains at least ε n t 2 t+1 n ⌊n/2⌋ chains of length k. Apart from the above, the only supersaturation result in the area of forbidden subposet problems is due to Patkós [19]. It gives the minimum number of copies of the butterfly poset 2 B in families of size La(n, B) + E for small values of E.
We will investigate the number of copies of P created when the number of additional sets compared to a largest P -free family is proportional to the size of the middle level [n] ⌊n/2⌋ . Let M(n, P ) denote the number of copies of P in the e(P ) + 1 middle levels of 2 [n] , and let M * (n, P ) denote the number of induced copies of P in the e * (P ) + 1 middle levels of 2 [n] . The Hasse diagram of a poset P is the directed graph with vertex set P and for p, q ∈ P , (pq) is an arc in the Hasse diagram if p < q and there does not exist z ∈ P with p < z < q. We say that P is connected, if its Hasse diagram (as a digraph) is weakly connected, i.e., we cannot partition its vertices into two sets such that there is no arc between those sets. The undirected Hasse diagram is the undirected graph obtained from the Hasse diagram by removing orientations of all arcs.
Proposition 3. For any connected poset P on at least two elements there exist positive integers x(P ) and x * (P ) such that M(n, P ) = Θ n x(P ) n ⌊n/2⌋ and M * (n, P ) = Θ n x * (P ) n ⌊n/2⌋ hold.
Proof. The proofs of the two statements are analogous, so we include only that of the non-induced version. For a copy G of P with all sets from the e(P ) + 1 middle levels of where the maximum runs through all the copies G of P with all sets from the e(P ) + 1 middle levels of 2 [n] .
We claim that for any such G, we have M G − m G ≤ e(P )|P | (in other words x(P ) ≤ e(P )|P |). Indeed, as P is connected, we can go through its elements in an order such that every element is in relation with at least one of the earlier elements. As G is from the e(P ) + 1 middle levels, this means that the new element is a set that is either contained in, or contains an earlier set, thus it differs from that set in at most e(P ) elements. In the first case, this new element decreases m G by at most e(P ), in the second case it increases M G by at most e(P ), so we are done.
Similarly, one can show |m G − n/2|, |M G − n/2| ≤ e(P )|P |. Clearly, for any A ⊆ B with |B| − |A| ≤ e(P )|P | there is at most a fixed constant number of copies G of P such that A = A G and B = B G . Finally, the number of pairs A ⊆ B, with |B \A| ≤ x(P ), ||A|−n/2| ≤ e(P )|P | and ||B| − n/2| ≤ e(P )|P | is at most C n . This yields M(n, P ) = O(n x(P ) n ⌊n/2⌋ ). For the lower bound, fix a copy G with |B G \ A G | = x(P ). Clearly, for any A ′ ⊆ B ′ with |A ′ | = |A G |, |B ′ | = |B G | there exists a permutation π of [n] with π(A G ) = A ′ and π(B G ) = B ′ . Therefore, such permutations π map G into distinct copies of P . Their number is clearly at least for some positive constant c. Now we can state the first generalization of Conjecture 1.

Conjecture 4.
(i) For every poset P and ε > 0 there exists δ > 0 such that if F ⊆ 2 [n] is of size at least (e(P ) + ε) n ⌊n/2⌋ , then F contains at least δ · M(n, P ) many copies of P . (ii) For every poset P and ε > 0 there exists δ > 0 such that if F ⊆ 2 [n] is of size at least (e * (P ) + ε) n ⌊n/2⌋ , then F contains at least δ · M * (n, P ) many induced copies of P . We will prove Conjecture 4 for several classes of tree posets. A poset T is a tree poset, if its undirected Hasse diagram is a tree. Note that for any tree poset T of height 2, we have x(T ) = x * (T ) = |T | − 1.
Theorem 5. Let T be any height 2 tree poset of t + 1 elements. Then for any ε > 0 there exist δ > 0 and n 0 such that for any n ≥ n 0 any family F ⊆ 2 [n] of size |F | ≥ (1 + ε) n ⌊n/2⌋ contains at least δn t n ⌊n/2⌋ copies of T . We say that a tree poset T is upward (downward) monotone, if for any x ∈ T there exists at most 1 element y ∈ T with y ≺ x (x ≺ y). A tree poset is called monotone, if it is either upward or downward monotone. The complete multipartite poset K r 1 ,r 2 ,...,r ℓ is a poset on ℓ i=1 r i elements a i,j with i = 1, 2, . . . , ℓ, j = 1, 2, . . . , r i such that a i,j < a i ′ ,j ′ if and only if i < i ′ . The poset K 1,r is usually denoted by ∨ r , and the poset K r,1 is denoted by ∧ r . The poset K s,1,t is a tree poset with x(K s,1,t ) = x * (K s,1,t ) = s + t.
Theorem 7. For any s, t ∈ N and ε > 0 there exist n 0 = n ε,s,t and δ > 0 such that any F ⊆ 2 [n] of size at least (2 + ε) n ⌊n/2⌋ with n ≥ n 0 contains at least δn s+t n ⌊n/2⌋ induced copies of K s,1,t .
We will consider the supersaturation problem for the generalized diamond D s , i.e., the poset on s+2 elements with a < b 1 , b 2 , . . . , b s < c. For any integer s ≥ 2, let us define m s = ⌈log 2 (s+2)⌉ and m * s = min{m : s ≤ m ⌈m/2⌉ }. Clearly, for any integer s ≥ 2, we have e(D s ) = x(D s ) = m s and e * (D s ) = x * (D s ) = m * s . The next theorem establishes a lower bound that is less by a factor of √ n than what Conjecture 4 states for diamond posets D s for infinitely many s.
, then for any ε > 0 there exists a δ > 0 such that every F ⊆ 2 [n] with |F | ≥ (m s + ε) n ⌊n/2⌋ contains at least δ · n ms−0.5 n ⌊n/2⌋ copies of D s . (ii) For any ε > 0 there exists a δ > 0 such that every F ⊆ 2 [n] with |F | ≥ (4 + ε) n ⌊n/2⌋ contains at least δ · n 3.5 n ⌊n/2⌋ induced copies of D 4 . (iii) For any constant c with 1/2 < c < 1 there exists an integer s c such that if s ≥ s c and s ≤ c m * s ⌊m * s /2⌋ , then the following holds: for any ε > 0 there exists a δ > 0 such that every F ⊆ 2 [n] with |F | ≥ (m * s + ε) n ⌊n/2⌋ contains at least δ · n m * s −0.5 n ⌊n/2⌋ induced copies of D s . Let us turn our attention to counting (induced) P -free families. As we mentioned earlier, every subfamily of a P -free family is P -free, therefore 2 La(n,P ) ≥ 2 (e(P )+o(1))( n ⌊n/2⌋ ) is a lower bound on the number of such families. Determining the number of P 2 -free families has attracted a lot of attention. The upper bound 2 (1+o(1))( n ⌊n/2⌋ ) , asymptotically matching in the exponent the trivial lower bound was obtained by Kleitman [15]. After several improvements, Korshunov [16] determined asymptotically the number of P 2 -free families.
Finally, we turn to random versions of forbidden subposet problems. The probabilistic version of Sperner's theorem was proved by Balogh, Mycroft, and Treglown [1] and Collares and Morris [17], independently. It states that if p = ω(1/n), then the largest antichain in P(n, p) is of size . This is sharp in the sense that if p = o(1/n) then the asymptotics is different. Note that as any k-Sperner family is the union of k antichains, the analogous statement holds for k-Sperner families in P(n, p). Both papers used the container method. Hogenson in her PhD thesis [12] adapted the method of Balogh, Mycroft, and Treglown to obtain the same results for non-induced ∨ r -free families.
Let us state a general proposition that gives a range of p when one can have a P -free family in P(n, p) that is larger than p(e(P ) + o(1)) [n ⌊n/2⌋ . Proposition 11. For any finite connected poset P , the following statements hold.
|P |−1 ), then the largest P -free family in P(n, p) has size at least (e(P ) |P |−1 ), then the largest induced P -free family in P(n, p) has size at least (e * (P ) + 1 − o(1))p n ⌊n/2⌋ w.h.p.. Proof. We only prove (i), the proof of (ii) is similar. Let us denote the random family of the e(P ) + 1 middle levels after keeping any of its sets with probability p by M p = M ∩ P(n, p). Clearly, E(|M p |) = (e(P ) + 1 + o(1))p n ⌊n/2⌋ and thus we have |M p | = (e(P ) w.h.p.. Let X be the random variable that denotes the number of copies of P in M p . Then we have E(X) = Θ(p |P | n x(P ) n ⌊n/2⌋ ). By the assumption on p, we have p |P | n x(P ) n ⌊n/2⌋ = o(p n ⌊n/2⌋ ), and so X = o(|M p |) w.h.p., and thus by removing the copies of P from M p , we obtain a P -free family in P(n, p) of size (e(P ) + 1 − o(1))p n ⌊n/2⌋ w.h.p.. If M p does not contain a subposet P ′ of P , then it is P -free, thus we have the following.

Corollary 12. For any finite poset
where P ′ runs through all connected subposets P ′ of P with e * (P ) = e * (P ′ ). Then the following statements hold.
(i) If p = o(n −d(P ) ), then the largest P -free family in P(n, p) has size at least (e(P ) , then the largest induced P -free family in P(n, p) has size (e * (P ) + 1 − o(1))p n ⌊n/2⌋ w.h.p. We conjecture that the bounds above are sharp.
Conjecture 13. For any finite connected poset P the following statements hold. (i) If p = ω(n −d(P ) ), then the largest P -free family in P(n, p) has size (e(P )+o(1))p n ⌊n/2⌋ w.h.p.. (ii) If p = ω(n −d * (P ) ), then the largest induced P -free family in P(n, p) has size (e * (P ) + o(1))p n ⌊n/2⌋ w.h.p.. Theorem 14. If p = ω(1/n), then the following are true. (i) For any integer r ≥ 0, the largest induced ∨ r+1 -free family in P(n, p) has size (1+o(1))p n ⌊n/2⌋ w.h.p.. (ii) For any pair s, t ≥ 1 of integers, the largest induced K s,1,t -free family in P(n, p) has size (2 + o(1))p n ⌊n/2⌋ w.h.p.. The structure of the paper is as follows: in the next section, we gather some earlier results that will be used as tools in the proofs of our theorems. Also, we will obtain an induced ∨ r+1 -free container lemma. Section 3, in three subsections, contain the proofs of our theorems.

Preliminaries
Here and in the next section, we will assume that n is large enough whenever it is necessary.
√ n⌋ and observe that for any k < n/2 we have So dividing l−1 i=0 n i into m subsums depending on the residue of i mod m, we obtain subsums that can be upper bounded by geometric progressions of quotient e −1 .
We denote by C k the set of chains of length k + 1, i.e. the set of maximal chains in 2 [k] .
be a family of sets such that any antichain A ⊂ G has size at most 3. Then the number of pairs (G, C) with G ∈ G ∩ C and C ∈ C k is at most 4k!.
(ii) For any constant c with 1/2 < c < 1 there exists an integer s c such that if s ≥ s c and s ≤ c m * s ⌈m * s /2⌉ , then the following holds: if G ⊆ 2 [k] is a family of sets such that any antichain A ⊂ G has size less than s, then the number of pairs (G, C) with G ∈ G ∩ C and C ∈ C k is at most m * s k!. The special case r = 1 of the next theorem was proved by Carroll and Katona [4].

Theorem 19.
For every ε > 0 and t, r ∈ Z + , if n is large enough and F ⊆ 2 [n] is of size at least (t+ε) n ⌊n/2⌋ , then there exists F ∈ F such that F is the bottom element of an induced copy of ∨ δn t with δ = ε 2 t+3 t! .
Proof. As |{G ⊆ [n] : ||G|−n/2| ≥ n 2/3 }| ≤ 1 n 2 n ⌊n/2⌋ , we can assume that n/2−n 2/3 ≤ |F | ≤ n+ n 2/3 holds for every F ∈ F and |F | ≥ (t + ε/2) n ⌊n/2⌋ . The Lubell-function λ n (F ) : of sets is the average number of sets in F ∩C over all maximal chains C ∈ C n . Clearly, |F | ≥ (t + ε/2) n ⌊n/2⌋ implies λ n (F ) ≥ t + ε/2. Let C F be the collection of maximal chains C ∈ C n such that F is the smallest set in F ∩ C, and let C ∅ be the collection of those maximal chains that avoid F . Let us partition This means that for some F ∈ F , we must have λ n−|F | (F F ) ≥ t+ε/2. If F does not contain any induced copy of ∨ δn t , then for any i ≥ t we have |{F ′ ∈ F F : This is a contradiction if δ ≤ ε 2 t+3 t! . Hogenson [12], altering a proof of Balogh, Mycroft, and Treglown [1], obtained a container lemma for non-induced ∨ r+1 -free families. With the help of Theorem 19, we can validate it for induced ∨ r+1 -free families.
For a family G of sets in 2 [n] and a set F ⊆ 2 [n] , we introduce U G (F ) = {G ∈ G : F ⊆ G}. Previous proofs used the G-degree of F , the size of U G (F ). Observe that F is ∨ r+1 -free if and only if the F -degree of every F ∈ F is at most r. We introduce the G-weight of F as the size of the largest antichain in U G (F ). Observe that F is induced ∨ r+1 -free if and only if the F -weight of every F ∈ F is at most r. Now we state the appropriate container lemma.
At the beginning we set G 0 = 2 [n] , H 0 1 = H 0 2 = ∅ and we start at Phase I. Later in the ith round (for i = 1, 2, . . . ) we always pick a G i ∈ G i−1 with largest G i−1 -weight. If there are several sets G with the same (largest) G i−1 -weight, we pick the one appearing first in our fixed ordering of 2 [n] .
Phase I.
and the G i−1 -weight of G i is more than n t+0.9 , then we pick the largest antichain If there are multiple such antichains, we pick the one with the smallest index in our fixed ordering of 2 2 [n] and set and the G i−1 -weight of G i is at most n t+0.9 , then Phase I is ended, we keep (from here on, H i 1 does not change) and define f (H 1 ) = G i . And jump to Phase II.
Phase II.
and the G i−1 -weight of G i is more than ε 2 n t , then we again take the largest and the G i−1 -weight of G i is at most ε 2 n t , then Phase II and the algorithm is ended, set Observe the following: • whenever we include sets in H i 1 , then the number of such sets is at most r + 1 (as F is ∨ r+1 -free), and the number of sets removed from G i−1 is at least n t+0.9 , so |H 1 | ≤ (r + 1)2 n /n t+0.9 ; • at the end of Phase I, G i does not contain any induced copies of ∨ n t+0.9 , so, by Theorem 19, |f (H 1 )| = |G i | ≤ (t + 1 + ε) n ⌊n/2⌋ ; • the above two bullet points and the threshold for Phase II imply that • Theorem 19 implies that at the end of Phase II, All what remains to prove is that the function f and g are well defined, i.e., if for two distinct ∨ r+1 -free families F and F ′ the algorithm outputs the same H 1 , then f (H 1 ) is defined the same, and if in addition H 1 ∪ H 2 is the same for both run of the algorithm, then so is g (H 1 ∪ H 2 ). We claim more: the families G i , H i 1 , H i 2 are the same for both runs for all values of i = 0, 1, . . . . This is certainly true for i = 0. Then by induction, if this holds for some i, then G i is the same for both run. Therefore, due to the fixed ordering of 2 [n] , the algorithm considers the same set G i+1 ∈ G i in step i + 1. As G i+1 will be removed from G i in all cases, therefore it cannot happen that G i+1 belongs to exactly one of F , F ′ . If G i+1 / ∈ F , F ′ , then G i+1 is removed from G i and nothing happens to H 1 , H 2 so the claim is true for i + 1. If G i+1 ∈ F ∩ F ′ , then, due to the fixed ordering of 2 2 [n] , the antichain A i+1 is defined the same for both runs. This immediately yields that G i+1 is defined the same for both runs. Also, as for any A ∈ A i+1 either A becomes a set of H 1 , H 2 in this step or never, and in the end these sets are the same, therefore they must be the same after step i + 1.

∨ r+1 -free families and consequences -Theorem 7, 10, and 14
In this subsection we present the proofs of our theorems concerning ∨ r+1 -free and K s,1,t -free families. We restate the theorems here for convenience.
Theorem 7. For any s, t ∈ N and ε > 0 there exist n 0 = n ε,s,t and δ > 0 such that any F ⊆ 2 [n] of size at least (2 + ε) n ⌊n/2⌋ with n ≥ n 0 contains at least δn s+t n ⌊n/2⌋ induced copies of K s,1,t .
Proof. Let F ⊆ 2 [n] be a family of sets of size (2+ε) n ⌊n/2⌋ . Let D be the family of those elements of F that are not the maximal element of an induced ∧ εn/10 and U the family of those that are not the minimal element of an induced ∨ εn/10 . By Theorem 18, we have |D|, |U| ≤ (1 + 4ε/10) n ⌊n/2⌋ , thus |F \ (D ∪ U)| ≥ ε 5 n ⌊n/2⌋ . Taking sets from F \ (D ∪ U) to play the role of the middle element of K s,1,t , by definition of D and U, we obtain at least ε Proof. To prove (i), we apply our container lemma, Theorem 20 with t = 1. It shows that for every induced ∨ r+1 -free family F , there exist H 1 , H 2 and g(H 1 ∪ H 2 ) such that H 1 and H 2 are disjoint, |H 1 ∪H 2 | ≤ (r +1) 3 ε 2 n n ⌊n/2⌋ , |g(H 1 ∪H 2 )| ≤ (1+ε) n ⌊n/2⌋ and F ⊆ H 1 ∪H 2 ∪g(H 1 ∪H 2 ). Therefore, |H 1 ∪H 2 ∪g(H 1 ∪H 2 )| ≤ (1 + 2ε) n ⌊n/2⌋ . The number of subfamilies of such containers is at most 2 (1+2ε)( n ⌊n/2⌋ ) , and the number of such containers is at most 2 n (r + 1) 3 Indeed, the first term is an obvious upper bound on the number of families H 1 ∪ H 2 , and the second term is an obvious upper bound on the number of ways to partition H 1 ∪ H 2 to H 1 and H 2 . Using n ⌊n/2⌋ = Θ( 1 √ n 2 n ) and a b ≤ ( ea b ) b , we obtain that the number of induced ∨ r+1 -free families in 2 [n] is at most 2 n (r + 1) 3 The lower bound follows from the fact that every subfamily of the middle level is ∨ r -free.
To prove (ii), observe that every induced K s,1,t -free family F ⊆ 2 [n] can be written as F = D ∪ U such that D is induced ∧ s -free and U is induced ∨ t -free. Indeed, let D be the family of those elements of F that are not the maximal element of an induced ∧ s and U be the family of those that are not the minimal element of an induced ∨ t . If F ∈ F does not belong to D ∪ U, then F with its s subsets and its t supersets form an induced K s,1,t , which contradicts the K s,1,t -free property of F . By part (i), there are 2 (1+o(1))( n ⌊n/2⌋ ) induced ∨ t -free families in 2 [n] and there are 2 (1+o(1))( n ⌊n/2⌋ ) induced ∧ s -free families in 2 [n] . Therefore there are at most 2 (2+o(1))( n ⌊n/2⌋ ) induced K s,1,t -free families in 2 [n] . The lower bound immediately follows from the fact that every subfamily of the middle two levels is K s,1,t -free. (ii) For any pair s, t ≥ 1 of integers, the largest induced K s,1,t -free family in P(n, p) has size (2 + o(1))p n ⌊n/2⌋ w.h.p. Proof. To prove (i), we again apply Theorem 20 with t = 1. All calculations are very close to those in [12], which in turn are almost the same as those in [1], we include them for sake of completeness.
It is enough to prove the statement for ε < 1 4 and set ε 1 = ε/4. We will show that w.h.p. for every ∨ r+1 -free family F in 2 [n] of size at least (1 + ε)p n ⌊n/2⌋ , not all sets of F remain in P(n, p). For every such F , Theorem 20 with ε 1 in the role of ε, gives us ≤(r+1)2 n n −1.9 ; therefore the number of possible H 1 's is at most a≤(r+1)2 n n −1.9 2 n a .

Results on trees -Theorem 5 and 6
Lemma 21. Let − → T be a directed tree with t edges that does not contain directed paths of length 2. Then there exists a δ > 0 such that the following holds: if f (m) tends to infinity with m and − → G m is a directed graph on m vertices with f (m) · m edges, then Proof. It is a well-known fact that every undirected graph contains a cut (i.e., a partition of its vertices into two and the edges between the parts) that contains at least half of its edges. This fact easily implies that the vertex set of  Proof. Let us generate an embedding i of T into the h(T ) middle levels. Assume without loss of generality that T is upward monotone, thus the root must be mapped to the lowest of the middle levels. We will refer to this level as the first middle level, and analogously the level above it is the second middle level, and the kth middle level is above the first level by k − 1.
Observe that there are (1 + o(1)) n ⌊n/2⌋ ways to pick the image of the root. Then we define i by going through the elements of T in a non-decreasing order with respect to the rank r(p). That means that for every element p, when we decide where to embed it, we have already embedded its predecessor, the (unique) element p ′ that is smaller than p such that there is no element p ′′ with p ′ < p ′′ < p.
If the predecessor p ′ of p is mapped to the jth middle level and we want to map p to the kth middle level, then the number of possibilities is Θ(n k−j ).
where p ′ is the predecessor of p and the summation goes over all elements of P apart from the root. Therefore, to obtain x(T ), we need to maximize Θ(n p∈P (f (p)−f (p ′ )) ). Clearly, when embedding a leaf ℓ, we must have f (ℓ) = h(T ). Finally, observe that if for some non-leaf p, we have f (p) > f (p ′ ) + 1, then changing f (p) to f (p ′ ) + 1 cannot decrease the sum (and strictly increases it, if p has at least two children). This shows that a function f that maximizes the sum must satisfy f (ℓ) = h(T ) for all leaves, and f (p) = r(p) for all non-leaves.
ii) For every i = 2, 3, . . . , h and F ∈ F i there exist at least δ 2 n sets F ′ ∈ F i−1 with F F ′ .
iii) For every i = 2, 3, . . . , h and F ∈ F i there exist at least δ 3 n i−1 sets F ′ ∈ F 1 with F F ′ .
Then for any upward monotone tree poset T of height h(T ) = h, F 1 contains at least δn x(T ) n ⌊n/2⌋ copies of T , where δ > 0 is a constant depending on δ 1 , δ 2 , δ 3 and |T |. Proof. We generate embeddings of T as follows: we embed elements of T according to their rank. The root of T can be embedded to any set F ∈ F h . By i), we have at least δ 1 n ⌊n/2⌋ choices. Any non-leaf element x ∈ T with its predecessor embedded to F i ∈ F i can be embedded to any set F ′ ∈ F i−1 with F i F ′ that has not yet been used by the embedding. By ii), we have at least δ 2 n − |T | choices. If x is of rank r(x) then this process will embed it to F h+1−r(x) .
If ℓ is a leaf vertex of rank r(ℓ) in T , then its predecessor is embedded into some F ∈ F h+2−r(ℓ) . We can embed ℓ to any superset of F that has not yet been used. By iii), there exist at least δ 3 n h+1−r(ℓ) − |T | such sets.
Proposition 22 yields that the exponent of n in the number of embeddings generated this way will be exactly x(T ). (We get a factor of n for all vertices except for the root, and an additional n h−r(ℓ) for leaves ℓ.) A copy corresponds to at most |T |! embeddings. Theorem 6. For any monotone tree poset T and ε > 0, there exist δ > 0 and n 0 such that for any n ≥ n 0 any family F ⊆ 2 [n] of size |F | ≥ (h(T ) − 1 + ε) n ⌊n/2⌋ contains at least δn x(T ) n ⌊n/2⌋ copies of T .
. For i = 2, 3, . . . , h we define F i as follows. Let ε ′ := ε/2h. A set F ∈ F i−1 is in F i if the expected number of sets of F i−1 in a random chain between F and [n] is at least 1 + ε ′ . (F counts for all chains.) Let G i := F i−1 \ F i . We partition the n! full chains from ∅ to [n] as follows. Let C G denote the collection of those chains whose smallest member from G i is G. Let C 0 denote the collection of those full chains that avoid G i . If we take a random full chain from any of these collections, the expected value of members of G i in it is at most 1 + ε ′ . Therefore the expected value taken over all n! full chains is also at most 1 + ε ′ . This means that λ n (G i ) : and therefore |G i | ≤ (1 + ε ′ ) n ⌊n/2⌋ . These inequalities for i = 2, 3, . . . , h together imply i) of Lemma 23, if δ 1 < ε/2.
Consider a set F ∈ F i−1 . If F has at most δ 2 n supersets of size between |F |+1 and |F |+h−1 in F i−1 and at most (δ 2 + δ 3 )n h supersets in all of F i−1 , then the expected value of elements of which is smaller than ε ′ if δ 2 and δ 3 are a sufficiently small positive numbers compared to h and ε ′ . This means that any G ∈ F i has either at least δ 2 n proper supersets of size at most |G| + h−1 in F i−1 or at least (δ 2 + δ 3 )n h supersets in all of F i−1 .
The above statement trivially implies ii) of Lemma 23. We show that iii) of Lemma 23 follows as well. Let F ∈ F i for some 2 ≤ i ≤ h. We need to find at least δ 3 n i−1 supersets of F in F 1 . If it has (δ 2 + δ 3 )n h supersets in F i−1 then we are obviously done, so assume that this is not the case. We define a directed graph as follows. F has at least δ 2 n supersets of size at most |G| + h − 1 in F i−1 , let us direct an edge from F to all of them. Each of these sets will have at least δ 2 n supersets of size at most |G| + 2(h − 1) in F i−2 , direct an edge from the subset to the supersets. Continue this operation until we reach F 1 . Now we have at least (δ 2 n) i−1 directed paths from G to members of F 1 . All these members are of size at most |G| + (i − 1)(h − 1), therefore the number of paths leading to a single one of them is at most ((i − 1)(h − 1)) i−1 < h 2h . Thus we found at least (δ 2 n) i−1 h 2h supersets of G in F 1 . This is more than δ 3 n i−1 if δ 3 is sufficiently small compared to δ 2 and h.

Diamond-free families -Theorem 8
Let us recall that m s = ⌈log 2 (s + 2)⌉ and m * s = min{m : s ≤ m ⌈m/2⌉ } and that for any integer s ≥ 2, we have x(D s ) = m s and x * (D s ) = m * s .
We are going to count pairs (F, C) with F ∈ F ′ ∩ C and C is a maximal chain in [n]. On the one hand, using the first point above, this is clearly F ∈F |F |!(n − |F |)! ≥ (m s + ε/2)n!. To count the pairs in another way, we will use the min-max partition of the maximal chains. Let C n denote the set of all n! maximal chains in [n], and let us partition C n into ∪ F,F ′ C F,F ′ , where F, F ′ run through all pairs F ⊆ F ′ in F ′ and C F,F ′ := {C ∈ C n : F is minimal in F ′ ∩ C, F ′ is maximal in F ′ ∩ C}.
Those maximal chains that do not contain any F ∈ F ′ are gathered in C ∅ . For any pair F ⊆ F ′ in F ′ let us write b(F, F ′ ) = |F ′ ∩ {G : F G F ′ }|. Observe that the number of copies of D s in F ′ is at least F,F ′ b(F,F ′ ) s , in particular this number is at least |{(F, F ′ ) : b(F, F ′ ) ≥ s}|. Finally, let C j = b(F,F ′ )=j C F,F ′ and C <s = C ∅ ∪ s−1 j=0 C j and C ≥s = C n \ C <s . As b(F, F ′ ) < s is equivalent to [F, F ′ ] ∩ F ′ being D s -free, using Lemma 16, we obtain that the number of pairs (F, C) with F ∈ F ′ ∩ C and C ∈ C <s is at most m s n!. As a consequence, the number of pairs (F, C) with F ∈ F ′ ∩ C and C ∈ C ≥s is at least ε 2 n!. Observe that |C F,F ′ | ≤ |F |!(|F ′ | − |F |)!(n − |F ′ )! and thus the number of pairs (F ′′ , C) with F ′′ ∈ F ′ ∩ C and C ∈ C F,F ′ is at most (|F ′ |−|F |+1)|F |!(|F ′ |−|F |)!(n−|F ′ )!. Also if b(F, F ′ ) ≥ s, then |F ′ |−|F | ≥ m s . Fixing |F | and using ℓ ≤ |F |, |F ′ | ≤ n−ℓ, it is easy to see that (|F ′ |−|F |+1)|F |!(|F ′ |−|F |)!(n−|F ′ |)! is convex in |F ′ | and thus it is maximized either at |F ′ | − |F | = m s or when |F ′ | = n − ℓ. Plugging in one obtains that the maximum is taken when |F ′ | − |F | = m s . Using 2. from above, we obtain that for one fixed C F,F ′ ⊆ C ≥s the number of pairs (F ′′ , C) with F ′′ ∈ F ′ ∩ C and C ∈ C F,F ′ is at most Therefore the number of pairs F, F ′ with b(F, F ′ ) ≥ s and thus the number of copies of D s in F ′ is at least ε 2 20(m s + 1)!4 ms n ms−0.5 n ⌊n/2⌋ as claimed.
The proofs of (ii) and (iii) are basically the same. Instead of b(F, F ′ ) one introduces a(F, F ′ ), which is the maximum size of an antichain in F ′ ∩ [F, F ′ ], and partitions C n into C <s and C ≥s according to a(F, F ′ ). If a(F, F ′ ) < s, then F ′ ∩ [F, F ′ ] is induced D s -free, so for (ii), instead of Lemma 16, one applies Lemma 17 (i), and for (iii), one applies Lemma 17 (ii) to C <s . The number of induced copies of D s is at least the number of pairs with a(F, F ′ ) ≥ s and the computation to obtain a lower bound for this number is the same as in (i).