The codegree threshold for 3-graphs with independent neighbourhoods

Given a family of 3-graphs $F$, we define its codegree threshold $\mathrm{coex}(n, F)$ to be the largest number $d=d(n)$ such that there exists an $n$-vertex 3-graph in which every pair of vertices is contained in at least $d$ 3-edges but which contains no member of $F$ as a subgraph. Let $F_{3,2}$ be the 3-graph on $\{a,b,c,d,e\}$ with 3-edges $\{abc,abd,abe,cde\}$. In this paper, we give two proofs that $\mathrm{coex}(n, F_{3,2})= n/3 +o(n)$, the first by a direct combinatorial argument and the second via a flag algebra computation. Information extracted from the latter proof is then used to obtain a stability result, from which in turn we derive the exact codegree threshold for all sufficiently large $n$: $\mathrm{coex}(n, F_{3,2})= \lfloor n/3 \rfloor -1$ if $n$ is congruent to $1$ modulo $3$, and $\lfloor n/3 \rfloor$ otherwise. In addition we determine the set of codegree-extremal configurations.


Turán-type problems
that the Turán problems for 3-graphs are essentially equivalent to determining what minimum degree condition is needed to force a 3-graph on n vertices to contain a copy of a member of a given family F as a subgraph. A B Figure 1: Construction 1 of Keevash [19] on their Turán densities. Nagle [31] conjectured that γ(K − 4 ) = 1/4, while Czygrinow and Nagle [5] conjectured that γ(K 4 ) = 1/2, with lower-bound constructions coming in both cases from random tournaments. Recently, a subset of the authors proved γ(K − 4 ) = 1/4 using flag algebras [11].

3-graphs with independent neighbourhoods
Given a 3-graph G and a pair of distinct vertices x, y ∈ V (G), their joint neighbourhood in G is Γ(x, y) = {z ∈ V (G) : {x, y, z} ∈ E(G)}.
In an F 3,2 -free 3-graph, the joint neighbourhoods form independent (edge-free) subsets of the vertex set. Such 3-graphs are thus said to have independent neighbourhoods.
As mentioned in Section 1.1, the Turán density and Turán number of F 3,2 were determined by Füredi, Pikhurko and Simonovits [13,14], who showed that the extremal configurations were 'one-way bipartite' 3-graphs. Construction 1. Given a vertex set V and a bipartition V = A ⊔ B, we define a one-way bipartite 3-graph D A,B on V by taking as the 3-edges all triples {a 1 , a 2 , b} with a 1 , a 2 ∈ A and b ∈ B.
It is easy to see that D A,B has independent neighbourhoods, and that the number of 3-edges in D A,B is maximised when |A| = 2|B| + O(1).
Theorem (Füredi, Pikhurko and Simonovits [14]). If a 3-graph G on n vertices with independent neighbourhoods has ex(n, F 3,2 ) 3-edges, then there exists a partition V (G) = A ⊔ B of its vertex set such that G = D A,B . which is maximised when the three parts A, B, C are balanced -that is, have sizes as equal as possible. Thus coex(n, F 3,2 ) ≥ ⌊n/3⌋−1. Bohman, Frieze, Mubayi and Pikhurko [3] conjectured that this provides a tight lower-bound for the codegree density.

Results and structure of the paper
In this paper we show that coex(n, {F 3,2 }) = ⌊n/3⌋ − 1 if n is congruent to 1 modulo 3 ⌊n/3⌋ otherwise, for all n sufficiently large, and determine the set of extremal configurations (which are close to but distinct from balanced T A,B,C configurations in general). This settles Conjecture 1 in the affirmative and fully resolves Problems 3 and 4 for the family F = {F 3,2 }.
We first give two proofs that the codegree density of F 3,2 is 1/3.
In Section 2, we give a purely combinatorial proof of Theorem 1 due to Marchant, which appeared in his PhD thesis [25]. In Section 3, we adapt the semi-definite method of Razborov to the codegree setting to give a second proof of Theorem 1. While this second proof, a computerassisted flag algebra calculation, is not nearly so elegant, it gives us some information about the structure of near-extremal 3-graphs. This information can be used together with a hypergraph removal lemma to prove a stability result. To state this formally, we need to make one more definition. Definition 1. Let G and H be 3-graphs on vertex sets of size n. The edit distance between G and H is the minimum number of changes needed to make G into an isomorphic copy of H, where a change consists in replacing an edge by a non-edge or vice versa.
Theorem 2 (Stability). Let G be an F 3,2 -free 3-graph on n vertices with Then G lies at edit distance at most o(n 3 ) from a balanced T A,B,C construction.
In addition we determine the set of extremal configurations. Since this set depends on the congruence class of n modulo 3 and in one case has a slightly technical description, we postpone the corresponding theorems to Section 4 (Theorems 37, 39, 46 and 50).
We end the paper with a discussion of 'mixed problems': given c: 0 ≤ c ≤ 1/3, what is the asymptotically maximal 3-edge density ρ c in F 3,2 -free 3-graphs with codegree density at least c? We make a conjecture regarding the value of ρ c .

Codegree density via extensions
In this section, we prove that γ(F 3,2 ) = 1/3. Our strategy is similar in spirit to the one espoused by de Caen and Füredi [6] in their work on the Turán density of the Fano plane: we show that if δ 2 (G) is large then G contains a copy either of F 3,2 or of some 'nice subgraph' H. In the latter case we repeat the procedure using the extra assumption that H is a subgraph of G: we find again either a copy of F 3,2 or a copy of an even 'nicer' subgraph, H ′ , and so on.
Our approach is based on Lemma 4, proved in the next subsection, which establishes the existence of 'nice' extensions of a subgraph in a 3-graph with high codegree. In Section 2.2, we define conditional codegree density -loosely speaking, the codegree density subject to the constraint of containing a particular subgraph H. This concept then allows us to apply Lemma 4 in a very streamlined fashion in the final subsection to prove Theorem 1.

Extensions
We prove here a useful lemma, which tells us that if we have a small subgraph H inside a 3-graph G which has a high minimum codegree δ 2 (G), then we can extend H to a slightly larger 'good' subgraph of H.
Definition 3. A sequence of 3-graphs (G n ) n∈N tends to infinity if |V (G n )| → ∞ as n → ∞. Also, given a 3-graph H, we say that a sequence (G n ) n∈N contains H if all but finitely many of the 3-graphs G n contain H as a subgraph.
Given a set S, write ∆(S) for the (|S| − 1)-dimensional simplex If H is a 3-graph and α ∈ ∆(V (H) (2) ), then α is a weighting on the pairs of vertices of H. We can now state and prove our key lemma.

Lemma 4.
Let H be a 3-graph. Suppose (G n ) n∈N is a sequence of 3-graphs tending to infinity with and that (G n ) n∈N contains H. Then for any α ∈ ∆(V (H) (2) ), there is a simple extension H ′ of H with xy∈L(H ′ ;H) α xy ≥ c and an infinite subsequence (G n k ) k∈N of (G n ) n∈N such that (G n k ) k∈N contains H ′ .
Proof. Let (G n ) = (G n ) n∈N be a 3-graph sequence tending to infinity with Suppose H is a 3-graph contained in (G n ) and let α ∈ ∆(V (H) (2) ).
We claim that for every ε > 0 there exists an extension H ′ of H such that H ′ is contained as a subgraph in infinitely many of the 3-graphs G n and the weaker condition holds. This is sufficient to prove the lemma as there are up to isomorphism only finitely many possible simple extensions of H, and so one of them must satisfy the weaker condition for all ε > 0.
Consider a 3-graph G n from our sequence with n ≥ N . Fix a copy of H within G n (we know by (iii) above that such a copy exists), and consider the weighted sum s = xy∈V (H) (2) α xy |Γ(x, y)| .
We have s ≥ (c − ε)|V (G n )| by (i) above. Also, s = z∈V (Gn) xy∈V (H) (2) : xyz∈E(Gn) α xy ≤   z∈V (Gn)\V (H) xy∈V (H) (2) : xyz∈E(Gn) Hence by averaging there exists a vertex z / ∈ V (H) such that Therefore the simple extension H ′ of H with vertex set V (H)∪{z} and 3-edges E(H)∪{xyz : xy ∈ V (H) (2) , xyz ∈ E(G n )} satisfies our weaker condition and is a subgraph of G n . Since there are up to isomorphism only finitely many extensions of H, one of them must satisfy the weaker condition and be contained in infinitely many of the 3-graphs in our sequence (G n ) n∈N . This concludes the proof of our claim and with it the proof of the lemma.
We shall sometimes write w α (L(H ′ ; H)), or simply w(L), for xy∈L(H ′ ;H) α xy . This quantity w(L) is exactly the total weight of the pairs picked up by the new vertex in the extension, with respect to the weighting α.

Conditional codegree density
Our arguments in the proof of Theorem 1 are of the form "if G contains H and δ 2 (G) is large then G must contain a copy of a member of F". It is thus natural to make the following definition.
Definition 4. Let H be a 3-graph, and let F be a family of nonempty 3-graphs. The conditional codegree threshold of F given H, denoted by coex(n, F|H), is the maximum of δ 2 (G) over all n-vertex, F-free 3-graphs G which contain a copy of H as a subgraph.
Our aim in this subsection is to show that we can define a conditional codegree density from this, in other words that the sequence coex(n, F|H)/n tends to a limit as n → ∞. This will be very similar to the proof that the usual codegree density is well-defined [30].
Lemma 5. Let H be a 3-graph and let ε > 0. Then there exists an integer N = N (ε, H) such that for all n, n ′ ∈ N with N ≤ n ′ ≤ n, every 3-graph G on n vertices containing a copy of H has a subgraph G ′ on n ′ vertices also containing a copy of H and satisfying (This is just saying that G ′ has 'codegree density' almost as large as G.) Proof. Let H be a 3-graph on h vertices, and let ε > 0. Suppose G is a 3-graph on n vertices containing a copy of H. We form an n ′ -vertex subgraph of G by fixing a copy of H in G and extending it by adding n ′ − h vertices selected uniformly at random from the rest of G. Let G ′ denote the resulting (random) induced subgraph of G. Clearly G ′ contains a copy of H and has the right order. Now let us show that -provided n and n ′ are sufficiently large -G ′ also has a good chance of having a reasonably high minimal codegree.
For x, y ∈ V (G ′ ) and t ∈ N, we have where X is the hypergeometric random variable Now, provided n, n ′ are both sufficiently large, We can now use a standard Chernoff bound for the hypergeometric distribution (see Hoeffding [18]) to show that the probability that x, y is a low codegree pair in G ′ is small.
Summing over all possible pairs in G ′ and using the union bound, we deduce that For n ′ sufficiently large, this is strictly less than 1. Thus with strictly positive probability G ′ satisfies δ 2 (G ′ )/n ′ > δ 2 (G)/n − ε as required -and in particular a good choice of G ′ exists.
With Lemma 5 in hand, we can now prove the main result of this section.
Proposition 6. For all 3-graphs H and all families of nonempty 3-graphs F not containing H, the sequence coex(n, F|H)/n tends to a limit as n → ∞.
Proof. Let H be a 3-graph and let F be a family of nonempty 3-graphs which does not contain H. Set a n = coex(n, F|H) n .
We shall show (a n ) n∈N is a Cauchy sequence and hence convergent in [0, 1].
Pick ε > 0, and let N = N (ε, H) be the integer whose existence is guaranteed by Lemma 5. Let n, n ′ ∈ N be integers with n ≥ n ′ ≥ N . Suppose G is an n-vertex F-free 3-graph containing a copy of H with δ 2 (G) = coex(n, F|H). By Lemma 5, G has an n ′ -vertex subgraph G ′ which contains a copy of H and satisfies δ 2 (G ′ )/n ′ ≥ δ 2 (G)/n − ε. Since G is F-free, so is G ′ , and we must thus have a n − a n ′ ≤ a n − δ 2 (G ′ ) n ′ ≤ a n − We claim that there also exists an integer M = M (ε, H) ≥ N such that for all integers n ≥ M we have a M − a n ≤ ε. Indeed, either M 1 = N is a good choice of M or there exists an integer M 2 > N with a M 2 < a N − ε. Then either M 2 is a good choice of M or there exists an integer M 3 > M 2 with a M 3 < a M 2 − ε, in which case we iterate the argument. As the sequence a M 1 , a M 2 , . . . consists of real numbers from [0, 1], is strictly decreasing and has gaps between successive terms of at least ε, it can have length at most 1 + ⌈1/ε⌉. Thus after a bounded number of iterations of our argument, we find a good choice of M .
Then for any n ≥ M , we have |a n − a M | ≤ ε. It follows that (a n ) n∈N is Cauchy as claimed, and so converges to a limit in [0, 1].
We may thus define the conditional codegree density of F given H.
Definition 5. Let F be a family of nonempty 3-graphs, and let H be a 3-graph not belonging to F. The conditional codegree density γ(F|H) of F given H is the limit n .
The following simple observation encapsulates the usefulness of conditional codegree densities in bounding codegree densities. Now suppose that (G n ) n∈N is a sequence of 3-graphs tending to infinity such that Let n be sufficiently large. Then, since γ(F ∪ {H}) ≤ c, G n must contain a member of F or H.
As γ(F|H) ≤ c, if G n contains H then it must contain a member of F also. In particular, G n contains a member of F. It follows that γ(F) ≤ c, as claimed.

Proof of Theorem 1
For an integer t, the blow-up F (t) of a 3-graph F is the 3-graph formed by replacing each vertex v of F by a set S v of t new vertices and placing for each 3-edge {x, y, z} ∈ E(F ) all t 3 triples meeting each of S x , S y and S z in one vertex. If F is a family of 3-graphs then its blow-up F(t) is defined to be the family {F (t) : F ∈ F}.
Just as the ordinary Turán density, the codegree density γ exhibits what is known as supersaturation: the codegree density of a finite family is the same as the codegree density of its blow-up. This fact was reproved by several researchers, see e.g. [23,24,30] Lemma 8 ( [23,24,30]). Let F be a finite family of 3-graphs and t ∈ N. Then γ(F(t)) = γ(F).
Having stated this lemma, let us now define some 3-graphs we shall need in our proof of Theorem 1. Recall from the introduction that K 4 is the complete 3-graph on four vertices, and K − 4 the 3-graph obtained from K 4 by deleting one of its 3-edges. Further, let S k denote the star on k + 1 vertices, that is, the 3-graph with vertex set {x, y 1 , . . . , y k } and 3-edges {xy i y j : 1 ≤ i < j ≤ k}. Note that S 3 is (isomorphic to) K − 4 . Finally, let S ′ k denote the 3-graph on k + 2 vertices obtained by duplicating the central vertex x of the star S k . Thus S ′ k has vertex set {x 1 , x 2 , y 1 , . . . , y k } and 3-edges {x 1 y i y j : 1 ≤ i < j ≤ k} ∪ {x 2 y i y j : 1 ≤ i < j ≤ k}.
Our strategy in the proof of Theorem 1 is to show that if a 3-graph G has codegree δ 2 (G) > 1 3 + ε |V (G)| and |V (G)| is large, then G contains a copy of F 3,2 or it is forced to contain copies of ever larger stars. We make this gradual ascension towards Theorem 1 in a series of lemmas on conditional codegree density, each of which relies on applying the key Lemma 4 with a suitable weighting α. In so doing, we shall repeatedly look for and find copies of F 3,2 inside larger 3-graphs, and it will be convenient to write "ab|cde" to mean that abc, abd, abe and cde are all 3-edges (and thus that {abcde} spans a copy of F 3,2 ).
Proof. Suppose (G n ) n∈N is a 3-graph sequence tending to infinity and containing S ′ k with lim inf Denote the vertices of S ′ k by V (S ′ k ) = {x 1 , x 2 , y 1 , . . . y k } as before, and partition the collection of pairs V (S ′ k ) (2) into the three sets We shall apply Lemma 4 using the following weight vector α ∈ ∆(V (S ′ k ) (2) ):

Lemma 4 guarantees that there is an extension
and an infinite subsequence (G n k ) k∈N such that (G n k ) k∈N contains H.
We now show that H must contain F 3,2 to conclude the proof of the lemma. This is essentially case-checking. Write L for the set L(H; S ′ k ), w for w α and z for the vertex added to S ′ k to form H.
Case 1: suppose that L contains the single pair x 1 x 2 from P 1 . If L contains any pair y i y j from P 3 then y i y j |x 1 x 2 z, so that we have a copy of F 3,2 as claimed. On the other hand if P 3 contains no edge of L, consider |L ∩ P 2 |. If this is at least three, then at least one of the vertices x 1 , x 2 , without loss of generality x 1 , must be incident to at least two edges of L ∩ P 2 . Let two such edges be x 1 y i and x 1 y j . Then zx 1 |x 2 y i y j , so that again we have a copy of F 3,2 as claimed. Finally note that if L ∩ P 3 = ∅ and |L ∩ P 2 | ≤ 2 then contradicting the fact that w(L) > k/(3k − 1). Thus we are done in this case.
Case 2: suppose that L does not contain x 1 x 2 , but contains at least one edge from P 2 . Without loss of generality let x 1 y i be one such edge. If y i is incident to two edges y i y j 1 and y i y j 2 of L∩P 3 , then zy i |x 1 y j 1 y j 2 and we have a copy of F 3,2 as required. On the other hand if L ∩ P 3 contains at least one edge y j 1 y j 2 not incident to y i , then x 1 y i |zy j 1 y j 2 , again spanning a copy of F 3,2 .
Now if L contains exactly one edge y i y j from P 3 then all edges in L ∩ P 2 are incident with one of y i , y j . In particular, |L ∩ P 2 | ≤ 4 and a contradiction. On the other hand if L contained no edge from P 3 , then again a contradiction of our assumption that w(L) > k/(3k − 1).
Case 3: finally, suppose that L contains no edge from P 1 or P 2 . Then L ⊆ P 3 , and contradicting our assumption that w(L) > k/(3k − 1).
It follows that H must contain a copy of F 3,2 , as claimed.
Proof. This is very similar to the proof of Lemma 10. Suppose (G n ) n∈N is a 3-graph sequence tending to infinity which contains S ′ k and satisfies lim inf Denote the vertices of S ′ k by V (S ′ k ) = {x 1 , x 2 , y 1 , . . . , y k } as before and partition V (S ′ k ) (2) into the three sets P 1 = {x 1 x 2 }, P 2 = {x i y j : 1 ≤ i ≤ 2, 1 ≤ j ≤ k} and P 3 = {y i y j : 1 ≤ i < j ≤ k}.
We apply Lemma 4 with a slightly different weighting. Let α be defined by:

Lemma 4 guarantees the existence of an extension
and of an infinite subsequence (G n k ) k∈N such that (G n k ) k∈N contains H.
We now show that any such extension H must contain either F 3,2 or S ′ k or K 4 . As in the previous lemma, this is just a matter of case-checking. Write L as before for the set L(H; S ′ k ), w for w α and z for the vertex added to S ′ k to form H.
Case 1: suppose x 1 x 2 ∈ L. By the analysis in Case 1 of Lemma 10, we know that if L contains any edge from P 3 or at least three edges from P 2 then H contains a copy of F 3,2 and we are done. On the other hand if neither of these happen then contradicting our assumption that w(L) > 1/3.
Case 2: suppose x 1 x 2 / ∈ L, but L ∩ P 2 = ∅. By the analysis in Case 2 of Lemma 10, we know that if L contain an edge from P 2 incident to two edges from P 3 or an edge from P 2 and a disjoint edge from P 3 , then H contains a copy of F 3,2 and we are done.
Also if L contains an edge y j 1 y j 2 of P 3 and two edges x i y j 1 , x i y j 2 from P 2 then zx i y j 1 y j 2 forms a copy of K 4 , and we are done. In addition if L contains all k edges of the form x 1 y j then x 1 , z, y 1 , . . . y k forms a copy of S k+1 , and we are done. Now let us suppose none of these things happen. If L contains an edge from P 3 then |L ∩ P 2 | ≤ 2 and |L ∩ P 3 | ≤ 1 (else we have a copy of K 4 or F 3,2 ) and thus a contradiction. On the other hand if L contains no edge from P 3 then |L ∩ P 2 | ≤ 2(k − 1) (else we have a copy of S k+1 ) and w(L) ≤ 2(k − 1) 6(k − 1) = 1/3 , again a contradiction.
Case 3: finally suppose L contains no edge from P 1 or P 2 . Then L ⊆ P 3 and contradicting yet again our assumption that w(H) > 1/3.
It follows that H must contain a copy of one of F 3,2 , K 4 or S k+1 , as claimed.
Proof. We shall in fact prove the slightly stronger statement that γ(F 3,2 |K ′′ }. In other words, K ′′ 4 is the 3-graph formed by duplicating two distinct vertices of K 4 (and hence a subgraph of K 4 (2)).
Suppose that (G n ) n∈N is a 3-graph sequence tending to infinity which contains K ′′ 4 and satisfies lim inf We apply Lemma 4 once more, with the following weighting α:

Lemma 4 guarantees the existence of an extension
and of an infinite subsequence (G n k ) k∈N such that (G n k ) k∈N contains H.
We now show that any such extension H contains a copy of F 3,2 as a subgraph. Write again L for the set L(H; K ′′ 4 ), w for w α and z for the vertex added to K ′′ 4 to form H. Since w(L) > 1/3, at least three of the edges in {ac 1 , ad 1 , bc 1 , bd 1 , c 1 c 2 , d 1 d 2 } must be contained in the link graph L. If the three edges in that set which are incident to c 1 are in L, then zc 1 |c 2 ab and we have a copy of F 3,2 . Also if c 1 c 2 ∈ L and L contains either of ad 1 or bd 1 then we have either ad 1 |c 1 c 2 z or bd 1 |c 1 c 2 z, and thus we have a copy of F 3,2 . Similarly if d 1 d 2 ∈ L and either of ac 1 or bc 1 are in L then we have ac 1 |d 1 d 2 z or bc 1 |d 1 d 2 z.
It follows in particular that if L contains c 1 c 2 then we have a copy of F 3,2 . In exactly the same way we are done if d 1 d 2 ∈ L. So finally suppose that neither of c 1 c 2 and d 1 d 2 is contained in L. Then at least three of the four edges ac 1 , ad 1 , bc 1 , bd 1 must be in. In particular we must contain a pair of non-incident edges from that set. Assume without loss of generality that ad 1 and bc 1 are both in. Then ad 1 |bc 1 z, so that we have again a copy of F 3,2 , as claimed.
With Lemmas 9,10, 11 and 12 in hand, we can finally prove our codegree density result.

Codegree density and stability via flag algebras
In this section, we use the flag algebra method of Razborov [33,34] to give a second proof of Theorem 1 and to obtain the stability result claimed in Theorem 2. Several good expositions of flag algebras from an extremal combinatorics perspective have already appeared in the literature [1,12,17,21]. We shall therefore be rather brief, directing the reader to the aforementioned papers for details. Our proof is generated by computer using Vaughan's Flagmatic package (version 2.0) [37]. A proof certificate is stored under the name F32Codegree.js in the ancillary folder of the arxiv version of this paper [10], which also contains the flagmatic code F32Codegree.sage that generated the certificate. In Section 3.1 we describe the structure of the file F32Codegree.js and show how the information contained therein implies the desired bound γ(F 3,2 ) ≤ 1 3 . Since the file is large (over 2MB) and contains integers with dozens of digits, verification of the proof requires a computer as well. In order to verify all the stated properties of the proof certificate, the reader can write her own script, or use the inspect certificate.py function included in Flagmatic to do some of the verifications for her.

Structure of the proof certificate
First of all, we refer the reader to the Flagmatic User's Guide [38] that, among many other things, describes how combinatorial structures (including types and flags that are defined below) are stored in proof certificates.
The certificate consists of various parts. Here we describe only those that are directly needed for verifying the validity of our proof.
Part "admissible graphs" lists the F 3,2 -free 3-graphs on N = 6 vertices up to isomorphism. There are exactly 426 of them; let us denote them by G 1 , . . . , G 426 .
Part "types" lists types with 2ℓ < N vertices, i.e. (vertex-labelled) F 3,2 -free 3-graphs with vertex set ∅, [2] and [4]. For our application, we need only one representative from each class of isomorphic 3-graphs; thus the number of listed types of order 0, 2 and 4 is respectively 1, 1, and 5. Let us denote them by τ 1 , . . . , τ 7 , using the same ordering as in Flagmatic: first by the number of vertices and then lexicographically by the list of 3-edges. For example, τ 2 is the type with 2 (labelled) vertices and no 3-edges while τ 7 is a vertex-labelled K 3 4 .
We can view a flag as a 3-graph with k labelled roots that induce a copy of τ (while the remaining vertices are treated as unlabelled). This leads to the natural definition of an isomorphism f between two τ -flags (F, x 1 , . . . , x k ) and (H, y 1 , . . . , y k ): namely an isomorphism f between the unlabelled 3-graphs F and H such that the roots are preserved, that is, f (x i ) = y i for every i ∈ [k].
Part "flags" contains for each t ∈ [7] the list of the τ t -flags F τt 1 , . . . , F τt gt with (N +|V (τ t )|)/2 vertices up to flag isomorphism. For example, if t = 1, then τ t is the type with no vertices, and we have to list all unlabelled 3-graphs of order 3; clearly, there are exactly two of them (edge and non-edge). If t = 2, then τ t is the (unique) 2-vertex type, and we have to list all 4-vertex 3graphs G with two roots; for e(G) = 0, 1, 2, 3, 4 there are respectively 1, 3, 4, 3, 1 non-isomorphic ways of placing the roots. Thus g 2 = 12.
For each i ∈ [7], the certificate (indirectly) contains a symmetric g i × g i -matrix Q τ i . More precisely, Q τ i = RQ ′ R T where Q ′ is a diagonal matrix all of whose diagonal entries are positive rational numbers (listed in part "qdash matrices") and R is a rational matrix (listed in part "r matrices"). This representation automatically implies that the matrix Q τ i is positive semidefinite.
Part "axiom flags" lists all τ 2 -flags with 5 vertices. Recall that τ 2 is the (unique) type with 2 labelled vertices. There are 154 such flags. Let us denote them by M 1 , . . . , M 154 . Part "density coefficients" lists non-negative rational numbers c 1 , . . . , c 154 , one for each flag M i .
Let τ be a type on [k]. For two τ -flags (F, x 1 , . . . , x k ) and (H, is the single 3-edge with two roots. Let G be an arbitrary F 3,2 -free 3-graph of (large) order n.
First, we compute two parameters σ 1 and σ 2 of G using the information above. We let where the sum is over all n(n − 1) choices of distinct ordered pairs (x 1 , x 2 ) from V (G). Note that if the minimum codegree of G is at least n/3 then σ 1 ≥ 0.
Since each Q τ i is positive semi-definite, we have that pQ τ i p T ≥ 0. Thus σ 2 is non-negative.
Let us take some type τ on [k] and two τ -flags F 1 and F 2 with respectively ℓ 1 and ℓ 2 vertices. Let ℓ = ℓ 1 + ℓ 2 − k. Consider the sum over all choices of k-tuples (x 1 , . . . x k ) that induce a copy of τ in G. (3) can be expanded as the sum over ℓ i -sets X i with Ignoring the choices when X 1 and X 2 intersect outside of {x 1 , . . . , x k }, the remaining terms can be generated by choosing an ℓ-set X = X 1 ∪ X 2 first, then distinct x 1 , . . . , x k ∈ X, and finally splitting the remaining vertices of X appropriately between X 1 and X 2 . Clearly, the terms that we ignore contribute at most O(n ℓ−1 ) in total. Also, the contribution of each ℓ-set X depends only on the isomorphism class of G[X]. Thus the sum in (3) can be written as an explicit linear combination of the subgraph counts P (H, G), where H runs over unlabelled 3-graphs with ℓ vertices, modulo an additive error term O(n ℓ−1 ). An explicit formula for computing this linear combination can be found in e.g. [33,Lemma 2.3].
Thus if we expand each quadratic form pQ τ i p T and take the sum over all suitable x 1 , . . . , x k ∈ V (G), where k = |V (τ i )|, then we obtain a (fixed) linear combination of P (G 1 , G), . . . , P (G 426 , G) with an additive error term of O(n 5 ). The analogous claim holds for each term in the right-hand side of (1). Thus both σ 1 and σ 2 can be represented in this form, that is, where each α i is a rational number that does not depend on n and that can be computed given the information above (namely the matrices Q τ j and the coefficients c j ). An explicit formula for α i is rather messy, so we do not state it.
The crucial properties that our certificate possesses is that each α i is non-positive and that c 2 > 0 for the τ 2 -flag "5:123(2)" (listed as M 2 in Part "axiom flags"), which in Flagmatic notation denotes the 5-vertex 3-graph with one 3-edge and two vertices of that 3-edge labelled.
These properties (involving rational numbers) can be verified by the scripts that come with Flagmatic and use exact arithmetic. Explicitly, the α i are stored in an array by Flagmatic, called problem. bounds. Asking sage to list all strictly positive elements in that array returns the empty set. As for the value of c 2 , this can be read out by using the varproblem script. We refer the reader to the file F32Codegree.sage that contains such a verification at the end.
Let ε be an arbitrary real with 0 < ε < 1 20 , and let n be sufficiently large. Pick an F 3,2 -free 3-graph G of order n and minimum codegree at least ( 1 3 + c)n. Given G, compute σ 1 and σ 2 as above. We already know that σ 2 ≥ 0. Also, as remarked earlier, the codegree assumption implies that each summand in (1) is non-negative, so that σ 1 ≥ 0.
Proof. Let us derive a contradiction from assuming that The number of pairs (x 1 , x 2 ) that appear for at least ε 2 n−2 3 different choices of X is at least ε 2 n 2 : indeed, otherwise the number of sets X as above is at most for n sufficiently large (since ε < 1 20 ), a contradiction. Each of these ε 2 n 2 pairs (x 1 , x 2 ) contributes at least cn × c j ε 2 n−2 3 to (1). Thus σ 1 = Ω(n 6 ), which contradicts (4). (Recall that σ 2 ≥ 0 while each α j ≤ 0.) Since ε > 0 was arbitrary it follows that our hypothetical counterexample G satisfies where H is the 5-vertex 3-graph with exactly one edge.
We now use the random sparsification trick, as in [16,Section 4.3]. Namely, fix p with 0 < p < min c 4 , 1 2 and let G ′ be obtained from G by deleting each edge with probability p. Then it is not hard to show (cf Lemma 5) that with high probability, has Ω(n 5 ) 5-sets that span at least one edge. Each such set produces a copy of H in G ′ with probability at least p ( 5 3 ) , which is small but strictly positive. In particular, with high probability P (H, G ′ ) = Ω(n 5 ): a typical outcome G ′ leads to a contradiction. Thus γ(F 3,2 ) ≤ 1 3 as claimed.

Generating the certificate
Although we have formally verified that γ(F 3,2 ) ≤ 1 3 , let us briefly describe the steps that led to the certificate. As we already mentioned, the ancillary folder of [10] also contains the flagmatic code F32Codegree.sage that generated it as well as the transcript of the whole session (file F32Codegree.txt).
The method of using positive semi-definite matrices Q τ i to obtain inequalities between subgraph densities is fairly standard by now and has been used for a number of other problems. The new ingredient is the (rather obvious) idea to use (1) for deriving consequences of the codegree assumption δ 2 (G) ≥ 1 3 n, namely that σ 1 ≥ 0 for any choice of non-negative coefficients c i . The verification that each α i can be made non-positive can be done via semi-definite programming. More specifically, one can create an unknown block-diagonal matrix X 0 whose blocks are Q τ 1 , . . . , Q τ 7 , followed by c 1 , . . . , c 154 as diagonal entries. Also, we added the extra restriction c 1 + · · · + c 154 = 1, to avoid the trivial solution when all unknowns are zero. This is done automatically by the function make codegree problem. The full support of general 'axioms' (such as the codegree assumption) is not implemented in Version 2.0 of Flagmatic. Hopefully, this will be done in future releases.
The choice N = 6 came from experimenting with the above approach (as N = 5 was not enough). Our experiments also suggested that the types τ 1 (empty vertex set) and τ 5 (two 3edges on 4 vertices) are not really needed, that is, we can let Q τ 1 and Q τ 5 be the zero matrices (thus making the rounding step easier as we will have fewer parameters). This was done by the command set inactive types.
A crucial observation for the rounding procedure is that any flag algebra proof as above has to satisfy some relations. Namely, if we run our flag algebra argument on an almost extremal example G = T V 1 ,V 2 ,V 3 with |V i | = n/3, then all the inequalities we obtain are tight up to an O(n 5 ) additive error. This has a number of consequences.
Call a 3-graph G i of order 6 sharp if α i = 0. The following lemma tells us a number of graphs must necessarily be sharp.
Lemma 14. If a 6-vertex 3-graph G i is isomorphic to an induced subgraph of some T A,B,C construction, then G i is sharp.
Proof. Let G be a balanced T A,B,C construction on n vertices. Since G i is an induced 6-vertex subgraph of a T A,B,C construction, it readily follows that P (G i , G) = Ω(n 6 ). Now the minimum codegree in G is at least = Ω(n 6 ), we must have α i = 0, as claimed.
Lemma 15. Let τ i be a type on k ∈ {0, 2, 4} vertices x 1 , . . . , x k which appears as an induced subgraph in a T A,B,C construction.
Form p as in (2), with G a balanced T A,B,C construction on n vertices, and write p for its ℓ 2 norm. Then the limit of p/ p as n → ∞ is a zero eigenvector of Q τ i .
Proof. Let G be a balanced T V 1 ,V 2 ,V 3 construction on n vertices. The codegrees of pairs from V (G) vary between ⌊n/3⌋ − 1 and ⌈n/3⌉, so that |σ 1 (G)| = O(n 5 ). Now, for all G i which are 6-vertex subgraphs of G we have by Lemma 14 above that α i = 0, while for all other 6-vertex 3-graphs G i we have P (G i , G) = 0. Equality (4)  . . x k ) is isomorphic to τ i . What is more, for every such ǫ-sequence the vector p formed as in (2) is identical (depends on ǫ but not on the choice of the x i ).
Fix ǫ ∈ {1, 2, 3} k . By the non-negativity of the summands contributing to σ 2 (G), we deduce that the sum of pQ τ i p T over all ǫ-sequences is at most O(n 5 ). Now this latter sum consists of Ω(n k ) identical terms, and p = Ω(n 3− k 2 ). It follows that It is straightforward to see that for each ǫ ∈ {1, 2, 3} k , the (unique) vector p/ p which can be formed from ǫ-sequences converges to a limit as n → ∞. It follows from the inequality above and the positive semi-definiteness of Q τ i that this limit is a zero eigenvector of Q τ i , as claimed.
In addition to the above, some further 'forced' identities can be derived.
Lemma 16. Let T ′ be obtained from a T V 1 ,V 2 ,V 3 construction with |V i | ≥ 6 for each i by adding an extra 'tripartite' 3-edge {u 1 , u 2 , u 3 } with u i ∈ V i . If a 6-vertex 3-graph G i is isomorphic to an induced subgraph of T ′ , then G i is sharp.
Proof. We may assume that G i contains the tripartite 3-edge {u 1 , u 2 , u 3 }, for otherwise it is isomorphic to an induced subgraph of T V 1 ,V 2 ,V 3 and we are done by Lemma 14.
n by adding the complete 3-partite 3-graph with parts U 1 ∪ U 2 ∪ U 3 , where U i ⊆ V i has size εn for some small ε > 0. This 3-graph is not F 3,2 -free but nothing prevents us from computing σ 1 and σ 2 (which are still nonnegative) using the same formulae as before. When we expand σ 1 + σ 2 as in (4), the coefficients α 1 , . . . , α 426 will be the same but we will have an extra sum H β H P (H, G) where H runs over 6-vertex 3-graphs, each containing a copy of F 3,2 . While we have no control over the sign of each β H , we know that they are constants independent of n. Also, we have P (H, G) ≤ (3ε) 4 n 6 . (Indeed, each H-subgraph of G has to use at least 4 vertices from U = U 1 ∪ U 2 ∪ U 3 because each copy of F 3,2 ⊆ G uses at least two added edges.) Since ε can be arbitrarily small, the terms of order O(ε 3 n 6 ) in the new version of (4) should have correct signs to avoid a contradiction. (There are no new terms of order εn 6 or ε 2 n 6 , as we need to hit at least three vertices of U to detect an added 3-edge.) For our G i , we have that P (G i , G) = Ω(ε 3 n 6 ). Indeed, take an arbitrary embedding f : V (G i ) → V (G) and modify it to obtain an embedding f ′ such that for every gives us another embedding of G i into G. Clearly, there are at least (1 − o(1))(εn) 3 (n/3) 3 possible ways to choose f ′ . Thus necessarily α i = 0 (otherwise we would violate the non-negativity of σ 1 + σ 2 ), and G i is sharp as claimed.
We call the additional 3-edge {u 1 , u 2 , u 3 } in Lemma 16 a phantom edge. Such edges can appear in an extremal configuration but with density o(1). Although sparse, they also force further sharp graphs as shown in Lemma 16. Similarly it can be shown that they force some further zero eigenvectors in addition to those given by Lemma 15. This phenomenon was first observed in [32,Section 3.4]. A new idea here is that the 'test' 3-graph G in the proof of Lemma 16 is not admissible.
The option phantom edge (new in Flagmatic 2.0 ) tells the computer to use these extra identities at the rounding step.
There happened to be some further zero eigenvectors in addition to those given by the observations above. Here we just guessed their values by inspecting the floating point solution and passed the information on to Flagmatic using its add_zero_eigenvectors function.

Stability
In this section we prove Theorem 2. Let G be an arbitrary F 3,2 -free 3-graph on [n] with minimum codegree (1/3+ o(1))n. We shall use the information from our flag algebraic proof of Theorem 1 to establish that G lies within edit distance o(n 3 ) of a balanced T A,B,C construction. First, let us show that almost all 6-vertex subgraphs of G are sharp 3-graphs.
Lemma 17. If a 6-vertex 3-graph G i is not sharp, then P (G i , G) = o(n 6 ).
By applying a version of an Induced Removal Lemma (see [35] for a very strong version as well as a historical account), we can therefore change o(n 3 ) edges of G and destroy all induced copies of non-sharp 3-graphs, without creating a copy of F 3,2 . Let G ′ denote the 3-graph thus obtained; by definition, all of the 6-vertex subgraphs of G ′ are sharp 3-graphs. Now, the transcript of our flag algebraic proof of Theorem 1 shows that the number of sharp 3-graphs and the number of 6-vertex 3-graphs that embed into T A,B,C plus a tripartite 3-edge are both 13. By Lemma 16, these two families of 6-vertex 3-graphs must therefore coincide. In fact, it is routine to check by hand that there are nine 6-vertex 3-graphs that can appear in T A,B,C as induced subgraphs and that by adding one tripartite 3-edge to T A,B,C we increase this number by four.
We deduce from this the following: is T A,B,C with at most one tripartite 3-edge added.
By removing o(n 3 ) edges from G, we may have destroyed our minimum codegree condition, but it will still hold on average: at most o(n 2 ) pairs can have codegree less than (1/3 + o(1))n in G ′ .
Let us now consider the type τ 6 which is a labelling of K − 4 .
For every 4-tuple of vertices abcd that induce K − 4 in G ′ (with abc, abd, acd ∈ E(G ′ )) form the vector p = p abcd as in (2). The transcript shows that there are 24 τ 6 -flags with 5 vertices; thus p abcd ∈ R 24 . Also, the transcript shows that the rank of Q = Q τ 6 is 23; thus the nullspace of Q is 1-dimensional. From Lemma 15 we know that the (unique up to a scaling) forced zero eigenvector z of Q consists of 21 entries 0 and three equal entries that correspond to the three τ 6 -flags with the unlabelled vertex having the following links in abcd: 1) ab, ac, ad 2) bc, bd, cd 3) empty. Indeed, the only way we see τ 6 in T V 1 ,V 2 ,V 3 is when a ∈ V i and b, c, d ∈ V i−1 for some i ∈ Z 3 ; by choosing the unlabelled vertex x in respectively V i−1 , V i , V i+1 , we get these link graphs (each appearing about n/3 times when each |V j | = n/3). Scale z so that it has unit ℓ 2 -norm z = 1.

Take a spectral decomposition
where the f i are eigenvectors of Q such that {f 1 , . . . , f 23 , z} forms an orthonormal basis of R 24 . Since Q 0 has rank 23, we have that each λ i > 0. Let λ = min(λ 1 , . . . , λ 23 ) > 0, a positive constant independent of n. Since (p, p) = (p, z) 2 Note that for all abcd inducing τ 6 , we have p abcd 2 = Ω(n 2 ). We know that abcd p abcd Qp T abcd = O(n 5 ). Thus, by Lemma 19, the right-hand side of (5) is O(n) = o( p abcd 2 ) for 'typical' abcd inducing τ 6 . Fix one such 'typical' 4-tuple abcd and consider p = p abcd . By the cosine formula, the approximate equality (p, z) 2 = (p, p) 2 + O(n) = p 2 z 2 (1 + o (1)) implies that p and z are almost collinear. It follows that p ∈ R 24 has 21 coordinates with values o(n) and 3 coordinates taking values (1/3 + o(1))n corresponding to the τ 6 -flags 1)-3) defined above. So, if we define V i ] lies within edit distance o(n 3 ) of the 3-graph T V 1 ,V 2 ,V 3 to conclude our proof of Theorem 2. We shall do this via a succession of easy lemmas. We again use 'x 1 x 2 |y 1 y 2 y 3 ' as a notational shorthand for the statement that the 3edges x 1 x 2 y 1 , x 1 x 2 y 2 , x 1 x 2 y 3 and y 1 y 2 y 3 are all present in our graph (and thus that {x 1 x 2 y 1 y 2 y 3 } spans a copy of F 3,2 , contradicting our assumption that G ′ is F 3,2 -free).
, then bc|xyz, both of which are contradictions.
Lemma 21. G ′ has no 3-edges of the form V 1 V 2 V 2 , that is, 3-edges with two vertices in V 2 and one in V 1 .
Proof. Take any z ∈ V 1 and distinct x, y ∈ V 2 . Consider G ′ [abcdxz]. By Lemma 18, we have that G ′ [abcdxz] = T A,B,C plus at most one tripartite edge for some partition abcdxz = A∪B ∪C. Since G ′ [abcd] ∼ = K − 4 , it follows that bcd are in one part, say A, and a lies in the next part B. Since xbc, xbd, xcd ∈ E(G ′ ), we must have x ∈ B. Likewise z ∈ A. Thus necessarily xzb, xzc, xzd ∈ E(G ′ ).

Lemma 22. All but o(n 3 ) 3-edges of the form
Proof. By our observation that most pairs in G ′ have codegree at least (1+o(1))n/3, by the fact that |W | = o(n) and by Lemma 20, the 3-graph G ′ [ 3 i=1 V i ] must have at least (1 − o(1)) n/3 2 × n/3 3-edges that intersect the independent set V 2 in at least two vertices. By Lemma 21, all these 3-edges are of the form V 2 V 2 V 3 , giving the required result.
Proof. If we take 'typical' x, y ∈ V 2 , then by Lemma 22, we have that |V 3 \ Γ(x, y)| = o(n). But Γ(x, y) is an independent set as G ′ is F 3,2 -free. The lemma follows.

By Lemmas 22 and 24 we conclude that all but at most o(n 3 ) 3-edges of the form
. This together with Lemma 23 implies that almost all 3-edges of the form V 3 V 3 V 1 are in G ′ in the same way as we showed that almost all V 2 V 2 V 3 3-edges are in G ′ in Lemma 22. Now, by Lemma 24 again, we have that only o(n 3 ) 3-edges of the form V 1 V 1 V 3 belong to E(G ′ ).
Finally, to finish the proof of stability, it remains to show that at most o(n 3 ) 3-edges are of the form V 1 V 2 V 3 .
It follows that G ′ (and hence G) lies within edit distance o(n 3 ) of a balanced T V 1 ,V 2 ,V 3 configuration. This concludes the proof of Theorem 2.

The codegree threshold
In this section, we determine the codegree threshold of F 3,2 for all sufficiently large n. This is a simple (but long) chain of arguments from stability, with a slight twist at the end when we deal with the fact that the extremal constructions are not unique and depend on the congruence class of n modulo 3.
We know from Theorem 2 that almost extremal 3-graphs are close to balanced T A,B,C constructions. We use this fact as our starting point and analyse a putative extremal example G via a series of lemmas to show that in fact G is not only close to a certain fixed, balanced T A,B,C construction, but that it consists exactly of a subgraph of this T A,B,C construction together with a small number of 'tripartite' 3-edges. As an immediate corollary, we have that for all n sufficiently large, coex(n, F 3,2 ) ≤ ⌊n/3⌋.
At that point we separate into cases corresponding to the congruence class of n modulo 3, and determine both the codegree threshold and the extremal constructions for all n sufficiently large.

The structure of almost extremal configurations
In our argument, we shall frequently need to locate potential F 3,2 -subgraphs inside larger 3graphs, and it will be convenient just as in Section 2 and 3 to write ab|cde to mean that abc, abd, abe and cde are all 3-edges (and thus that {abcde} spans a copy of F 3,2 ).
Let G be a 3-graph on n vertices with independent neighbourhoods and minimal codegree Let α i = |V i |/n for i = 1, 2, 3. The number of 3-edges in G with at least two vertices in V i is at most the number of 3-edges in T with this property plus the total number of bad 3-edges |B|. In particular the average codegree in G of pairs of vertices in V i is at most Since δ 2 (G) ≥ n/3 + o(n), we must have in particular α i = 1/3 + o(1) for i = 1, 2, 3. We have thus established parts (i) and (iii) of our lemma.
Finally for part (ii) observe that the total number of 3-edges in G satisfies We shall also write V i+1 for the part coming after V i in the cyclic order on {1, 2, 3}, so that V 3+1 = V 1 , etc.
We first prove six lemmas which show that the link graphs of all vertices of G look like they ought to (up to some small error) if G was a T A,B,C construction.
Proof. Pick x ∈ V (G), and suppose that both V 1 and V 2 contain Ω(n 2 ) edges of G x . Then there are Ω(n 4 ) choices of pairs yz ∈ E(G x [V 1 ]) and vw ∈ E(G x [V 2 ]). For each such choice, at least one of the triples yzv and yzw is missing from G and lies in M (for otherwise we would have yz|vwx, violating the assumption that G is F 3,2 -free). Now each such forbidden triple is counted in at most n quadruples {v, w, y, z}, implying that |M | = Ω(n 3 ), and contradicting part (ii) of Lemma 25.

Lemma 27.
For every x ∈ V (G) , there are at most o(n 3 ) triples w, y, z such that wz, yz ∈ E(G x ) and w, y come from two different parts V i , i ∈ {1, 2, 3}.
Proof. Pick x ∈ V (G) and suppose for contradiction that Ω(n 3 ) such triples could be found. Then in particular we can find Ω(n 4 ) quadruples v, w, y, z such that vz, wz and yz all lie in E(G x ) and y ∈ V i , v, w ∈ V i−1 for some i ∈ {1, 2, 3}.
For each such quadruple, the triple vwy is missing from G and lies in M (for otherwise we would have xz|vwy). As before, each such triple is counted in at most n quadruples, giving |M | = Ω(n 3 ) missing edges and contradicting part (ii) of Lemma 25.
For each i we can then by Lemma 27 partition all but o(n) vertices of V i into two parts V ′ i and V ′′ i satisfying the following: • for every y ∈ V ′′ i , there are at most o(n) z ∈ V i−1 ∪ V i such that yz ∈ E(G x ).
Since for every y ∈ V (G) the codegree of x and y in G is at least n/3 + o(n), since by Lemma 25 we have |V i | = n/3 + o(n) for i = 1, 2, 3, and since e(G x [V i ]) = o(n 2 ) by assumption, it follows that for every i the following hold: is almost complete bipartite (contains all but o(n 2 ) of the possible 2-edges); ] is almost complete bipartite (contains all but o(n 2 ) of the possible 2-edges).
contained Ω(n) vertices, then there would be only o(n 2 ) edges of G x between V 2 and V 3 . Since we are also assuming that V 3 contains only o(n 2 ) edges of G x , it follows that the average degree in G x of vertices in V 3 is at most |V ′ 1 | + o(n). But now since |V 1 | = n/3 + o(n), and since V ′ 1 and V ′′ 1 are disjoint subsets of V 1 both containing Ω(n) vertices, it follows that this average degree is at most (1 − c)n/3 + o(n) for some strictly positive constant c > 0. For n sufficiently large, this contradicts the fact that the minimal codegree in G is at least n/3 + o(n). (Consider the vertex x together with a typical vertex from V 3 .) On the other hand if we had, for example, Since we are assuming that e(G x [V 2 ]) = o(n 2 ) this implies in particular that all but o(n) vertices in V 2 have degree o(n) in G x , which again contradicts the fact that δ 2 (G) ≥ n/3 + o(n).
Proof. Pick x ∈ V (G) and suppose the claim of the lemma does not hold for some i. Proof. Pick x ∈ V (G). By Lemma 28, we may assume without loss of generality that e(G x [V 1 ]) and e(G x [V 2 ]) are both o(n 2 ), while e(G x [V 3 ]) = Ω(n 2 ), just as would expect it to be if G was a subgraph of T V 1 ,V 2 ,V 3 and x was chosen from V 1 .
By Lemma 29, we then know that e(G x [V 3 , V 1 ]) = o(n 2 ). Thus for y ∈ V 1 there are on average only o(n) edges of G x joining y to vertices in V 1 ∪ V 3 . On the other hand we know from the codegree condition on G that for every y ∈ V 1 the joint neighbourhood of x and y has size at least n/3 + o(n). Since |V 2 | = n/3 + o(n) (Lemma 25, part (iii)), it follows that for typical y ∈ V 1 , y is adjacent in G x to almost all z ∈ V 2 . In particular, G x [V 1 , V 2 ] is almost complete: at most o(n 2 ) of the possible edges between V 1 and V 2 are missing.
This and Lemma 27 imply that e(G x [V 2 , V 3 ]) = o(n 2 ). Thus all but o(n 2 ) edges of G x are internal to V 3 or lie between V 1 and V 2 . If x ∈ V 1 then d B (x) = o(n 2 ), whereas if x ∈ V 2 ∪ V 3 , we would have d B (x) = Ω(n 2 ). Since our partition V 1 ∪ V 2 ∪ V 3 was chosen to minimise the number of bad 3-edges, it must be that x was assigned to V 1 . The claim of the lemma thus holds for x.
Proof. Pick x ∈ V (X), and write d T (x) for the number of 3-edges of T = T V 1 ,V 2 ,V 3 containing x. Since by Lemma 25 we have |V i | = n/3 + o(n) for i = 1, 2, 3, it readily follows that d T (x) = n 2 /6 + o(n 2 ). Now the codegree condition δ 2 (G) ≥ n/3+ o(n) tells us that every y ∈ V (G)\{x} is incident with at least n/3 + o(n) edges in G x . It follows in particular that which by Lemma 30 is o(n 2 ), as desired.
We can now show that in fact all bad edges are tripartite, i.e. meet each of V 1 , V 2 and V 3 in one vertex.
Lemma 32. For every i ∈ {1, 2, 3}, V i is an independent set in G.
Proof. Suppose for contradiction that we had a 3-edge of G entirely contained within V i for some i. Without loss of generality, we may assume that we have {x, y, z} ∈ E(G) with all of x, y, z lying in V 1 . Then for every pair u, v from V 3 , we have that at least one of the triples uvx, uvy, uvz is missing from G, for otherwise uv|xyz. There are n 2 /18 + o(n) such pairs uv (since |V 3 | = n/3 + o(n)). It follows that at least one of {x, y, z} has missing degree at least n 2 /54 + o(n). This contradicts Lemma 31. Proof. Suppose we had such a bad 3 edge -without loss of generality xyz ∈ E(G) with x, y ∈ V 3 and z ∈ V 2 .
Suppose |Γ(x, y) ∩ V 1 | = Ω(n). Then there are Ω(n 2 ) a, a ′ ∈ V 1 such that axy and a ′ xy are both in E(G). But for such pairs, the 3-edge aa ′ z is missing from G, since otherwise we would have xy|aa ′ z. It follows that d M (z) = Ω(n 2 ), contradicting Lemma 31.
It follows that we cannot have bad 3-edges taking one vertex in V i−1 and two vertices in V i+1 .
Proof. Suppose without loss of generality that V 1 is the smallest of the three parts V 1 , V 2 and V 3 . Then |V 1 | ≤ ⌊n/3⌋. Now consider a pair of vertices x, y ∈ V 3 . By Lemmas 32 and 33, there is no bad edge of G containing both x and y. In particular the codegree of x and y in G is at most the codegree of x and y in T , which is exactly |V 1 |.

Divisibility and tripartite matchings
By Corollary 34, we know that for n large enough coex(n, F 3,2 ) ≤ ⌊n/3⌋. Construction 2 from the Introduction shows that for all n we have coex(n, F 3,2 ) ≥ ⌊n/3⌋− 1. Continuing on the work in the previous section (and re-using the previous section's notation), we now determine for n large enough which of the two possible values is the actual codegree threshold. In addition, we seek to describe the set of extremal examples. As this set depends on some divisibility conditions -specifically, on the congruence class of n modulo 3 -we separate out into three cases.
Before we do so, however, let us introduce some useful nomenclature. Let V 1 ⊔ V 2 ⊔ V 3 be a tripartition of a vertex set V . A tripartite 3-edge is a triple x 1 x 2 x 3 with x i ∈ V i for i = 1, 2, 3. Let F be a set of tripartite 3-edges. A pair of vertices is overused (by F ) if it is contained in at least two 3-edges of F . Next, F a tripartite pair matching, or just a tripartite matching, if every two elements of F intersect in at most one vertex (that is, there are no overused pairs).
Proposition 35. Let V be a set of vertices with tripartition V = V 1 ⊔ V 2 ⊔ V 3 . Then for any tripartite pair matching F the 3-graph G on V obtained by adding the 3-edges in F to Proof. This is a simple check. We know that T V 1 ,V 2 ,V 3 is F 3,2 -free. By symmetry of the construction, it is sufficient to check that for every a, a ′ , a ′′′ ∈ V 1 , b, b ′ ∈ V 2 and c ∈ V 3 , neither of the 5-sets {a, a ′ , b, b ′ , c} and {a, a ′ , a ′′ , b, c} induce a copy of F 3,2 in G. Without loss of generality the 3-edges contained in these two 5-sets are subsets of {aa ′ b, aa ′ b ′ , bb ′ c, abc, a ′ b ′ c} and {aa ′ b, aa ′′ b, a ′ a ′′ b, abc} respectively, neither of which contains a copy of F 3,2 .

4.2.1
The case n congruent to 0 modulo 3 When n is congruent to 0 modulo 3 and sufficiently large, the upper-bound in Corollary 34 is sharp, and moreover there is a simple description of all extremal configurations.
Before we give this construction, let us recall a basic fact from graph theory. A proper edge colouring of a 2-graph G with m colours is a map φ which assigns to each edge {a, b} ∈ E(G) a colour φ(a, b)   It follows from the definition of proper colourings that F is a tripartite pair matching on A ⊔ B ⊔ C. Thus every H ∈ T (n) is F 3,2 -free by Proposition 35. Furthermore, all vertex pairs in H have codegree m. It follows from Corollary 34 that H is extremal for the codegree problem for all n sufficiently large.
What is more, every extremal configuration belongs to T (n).
Proof. Let V 1 , V 2 and V 3 be as in Section 4.1. Consider any pair of vertices from V 1 . By Lemmas 32 and 33, their joint neighbourhood is a subset of V 2 , so that by the codegree condition we must have |V 2 | ≥ m. Similarly we have |V 3 | and |V 1 | both at least m, so that in fact we must have |V i | = m for i = 1, 2, 3. Furthermore, observe that all 3-edges taking two vertices x, x ′ in V i and one in V i+1 must be in E(G) (otherwise the pair x, x ′ would have codegree at most m − 1).
Write F for the set of tripartite 3-edges of G associated with the partition Let us show that F contains no overused pair. Suppose this was not the case. Without loss of generality we would then have vertices a ∈ V 1 , b ∈ V 2 and c, c ′ in V 3 such that abc and abc ′ are both in F and hence in G. Now let a ′ be any vertex in V 1 \ {a}. By the observation in the previous paragraph, both of cc ′ a ′ and aa ′ b are in E(G). But then we would have ab|cc ′ a ′ , a contradiction. Now let b ∈ V 2 and c ∈ V 3 . We know that |Γ(b, c)| ≥ m, that Γ(b, c) ⊆ V 1 ∪ V 2 \ {b} (Lemma 33). Thus there exists at least one vertex a = ψ c (b) ∈ V 1 with {a, b, c} ∈ E(G), and this vertex is unique (else (b, c) would be an overused pair). What is more if b ′ is an element of V 2 distinct from B, then we cannot have both of {a, b ′ , c} and {a, b, c} being 3-edges of G, for otherwise F would have an overused pair {a, c}. Since there are m distinct elements in each of V 1 and V 2 , it follows that for any c ∈ V 3 , ψ c is a bijection from V 2 to V 1 . Finally observe that if c and c ′ are distinct elements of V 3 then for any b ∈ V 2 , ψ c (b) = ψ c ′ (b), since otherwise {b, ψ c (b)} would be an overused pair for F . In particular the map φ assigning colour c to the 2-edge (b, ψ c (b)) is an edge colouring of the complete bipartite 2-graph between V 1 and V 2 using m colours.
The 3-graph G thus belongs to T (n), as claimed.

The case n congruent to 2 modulo 3
When n is congruent to 2 modulo 3 and sufficiently large, the upper bound in Corollary 34 is again sharp. Extremal constructions are very similar to the ones in the previous case. However, there are now some 3-edges in the extremal configuration which can be deleted without lowering the minimal codegree, so that a proof of an analogue of Proposition 37 becomes more delicate.
Construction 4 (Family T (3m + 2)). Pick any H from the family T (3m + 3) that was defined by Construction 3 and remove one vertex from H.
Clearly, any obtained 3-graph is F 3,2 -free and, as it is easy to check, has minimum codegree m.
Theorem 39. Let n = 3m + 2 be large. Let G be an F 3,2 -free 3-graph with v(G) = n and δ 2 (G) = m. Then G is a subgraph of some H ∈ T (n).
Proof. Let V 1 , V 2 , V 3 be as in Section 4.1. Consider any pair of vertices from V 1 . By Lemmas 32 and 33, their joint neighbourhood is a subset of V 2 , so that by the codegree condition we must have |V 2 | ≥ m. Similarly we have |V 3 | and |V 1 | both at least m.
Without loss of generality, we may therefore assume that |V 3 | = m, and m ≤ |V i | ≤ m + 2 for i = 1, 2. We know (Lemmas 33 and 32) that for every b, b ′ ∈ V 2 their joint neighbourhood is a subset of V 3 . By the codegree condition δ 2 (G) = m, it follows that all 3-edges taking two vertices in V 2 and one vertex in V 3 must be in E(G). We claim that in addition all 3-edges taking two vertices in V 3 and one in V 1 must be in E(G).
Proof. Suppose for contradiction we had a triple acc ′ / ∈ E(G) with c, c ′ ∈ V 3 and a ∈ V 1 . Consider Γ(a, c). We know from Lemmas 33 that this is a subset of V 3 ∪ V 2 \ {c, c ′ }, and must have size at least m. Since |V 3 \ {c, c ′ }| = m − 2, it follows that there must be at least two vertices b, b ′ ∈ Γ(a, c) ∩ V 2 . Now we know that for all c ′′ ∈ V 3 , bb ′ c ′′ ∈ E(G). In particular, for all c ′′ ∈ V 3 \ {c, c ′ }, the triple acc ′′ must also be missing from E(G), since otherwise we would have ac|bb ′ c ′′ . Running through the argument again with c ′′ instead of c ′ , it follows that axy is missing for all possible choices of distinct x, y ∈ V 3 . But then a ∈ V 1 has missing degree d M (a) ≥ m 2 = Ω(n 2 ), contradicting Lemma 31. Thus all triples taking two vertices in V 3 and one vertex in V 1 must be in G. Now let F be the set of tripartite 3-edges of G associated with the tripartition Lemma 41. F contains no overused pairs. Proof. We consider each possible type of overused pairs in turn, and show they cannot occur in G.
(i) Suppose first of all that we had an overused pair ac with a ∈ V 1 , c ∈ V 3 . Then there exist b, b ′ ∈ V 2 such that abc and ab ′ c are both in G. But then let c ′ be any element of V 3 \ {c}.
We know that both of acc ′ , bb ′ c ′ are in G (by Lemma 40 and the preceding remark), so we have ac|bb ′ c ′ , a contradiction.
(ii) Now suppose that we had an overused pair bc with b ∈ V 2 , c ∈ V 3 . Then there exist a, a ′ ∈ V 1 with abc, a ′ bc ∈ E(G). But we know that for any b ′ ∈ V 2 \ {b} we have bb ′ c ∈ E(G). In particular we cannot have aa ′ b ′ ∈ E(G) since otherwise bc|aa ′ b ′ . But we know that Γ(a, a ′ ) ⊆ V 2 (Lemmas 32 and 33), so this would imply that a, a ′ have codegree at most 1, contradicting our minimum codegree condition (provided n ≥ 8).
(iii) Finally suppose that we had an overused pair ab with a ∈ V 1 and b ∈ V 2 . Then there exist c, c ′ ∈ V 3 such that abc, abc ′ ∈ E(G). For any a ′ ∈ V 1 \ {a}, we have a ′ cc ′ ∈ E(G) (by Lemma 40). In particular we must have aa ′ b / ∈ E(G), since otherwise ab|a ′ cc ′ .

Now for all
, so that by the codegree assumption again there is at least one c ′′ ∈ V 3 such that a ′ bc ′′ ∈ E(G). The pair bc ′′ is then an overused pair taking one vertex in each of V 2 and V 3 , contradicting (ii).
Proof. We already know that m ≤ |V 1 | and |V 2 | ≤ m + 2. Suppose for contradiction that |V 2 | = m + 2 and thus Since |V 1 \ {a}| = m − 1, there must be at least one tripartite 3-edge containing the pair (a, b). Thus there must be in total at least |V 1 | · |V 2 | = m(m + 2) distinct tripartite 3-edges. Averaging over the m 2 pairs (a, c) ∈ V 1 × V 3 , we deduce that at least one such pair must be contained in at least two tripartite 3-edges, contradicting Lemma 41.
By symmetry, it also cannot be the case that |V 1 | = m + 2 and |V 2 | = |V 3 | = m, and we are done.
For every a, c ∈ V 1 × V 3 , we have Γ(a, c) ⊆ V 2 ∪ (V 3 \ {c}). Since δ 2 (G) = m and |V 3 | = m, it follows that there is at least one b ∈ V 2 such that abc ∈ E(G). Furthermore we know this b is unique since the set of tripartite 3-edges of G contains no overused pair. Define φ(a, c) = b.
Also, φ −1 (b) consists of vertex-disjoint pairs (again, as there are no overused pairs). Thus φ corresponds to some proper (m + 1)-edge colouring of A × B. It is easy to see that any (m + 1)-edge colouring of the complete bipartite graph K m+1,m extends to that of K m+1,m+1 (in fact, in the unique way). We conclude that G is a subgraph of some 3-graph in T (n + 1) and thus of some H ∈ T (n). This finishes the proof of Theorem 39.
Remark 43. Note that an extremal G can have some edges of the form aa ′ b with a, a ′ ∈ V 1 and b ∈ V 2 missing. Namely, if there exist c, c ′ ∈ V 3 such that abc and a ′ bc ′ are both 3-edges of G, then we may delete aa ′ b without lowering the codegree of G. On the other hand, for each pair a, a ′ ∈ V 1 we have at most one b ∈ V 2 for which aa ′ b is missing, and similarly for every pair (a, b) ∈ V 1 × V 2 we have at most one a ′ for which aa ′ b is missing.

4.2.3
The case n congruent to 1 modulo 3 In this section, let n = 3m + 1 be congruent to 1 modulo 3 and sufficiently large. Unlike the two previous cases, the upper bound in Corollary 34 is not sharp.
Proof. Let n = 3m+1 be large, and G, V 1 , V 2 , V 3 be as in Section 4.1. Suppose for contradiction that δ 2 (G) = m. Consider any pair of vertices from V 1 . By Lemmas 32 and 33, their joint neighbourhood is a subset of V 2 , so that by the codegree condition we must have |V 2 | ≥ m. Similarly we have |V 3 | and |V 1 | both at least m, so that in fact we must have two parts of size m and one part of size m + 1. Assume without loss of generality that |V 3 | = m + 1, and that By the codegree condition, all edges with two vertices in V 3 and one in V 1 or two vertices in V 1 and one vertex in V 2 must be in E(G). In addition, for every pair c) has codegree at least m and |V 2 | = m, it follows that there exists at least one a ∈ V 1 such that abc ∈ E(G). Summing over all possible pairs (b, c), we see that there must be at least m(m + 1) tripartite 3-edges in G. But there are only m 2 distinct pairs (a, b) ∈ V 1 × V 2 . Thus there is at least one such pair appearing in at least two tripartite 3-edges, i.e. there must be a ∈ V 1 , b ∈ V 2 , c, c ′ ∈ V 3 such that both abc and abc ′ are in E(G).
But then let a ′ be any vertex in V 1 \ {a}. By our earlier observations, we know that aa ′ b and cc ′ a ′ are both 3-edges of G, so that ab|cc ′ a ′ , contradicting the fact that G is F 3,2 -free.
A consequence of this lower codegree threshold is that the extremal structures are considerably more complicated. We present three families T 1 (n), T 2 (n) and T 3 (n) of extremal 3-graphs on [n] and show that for every extremal G there is some H ∈ ∪ 3 i=1 T i (n) containing G as a (spanning) subgraph. One could say more about the possible structure of E(H) \ E(G) (along the lines of Remark 43 here) but we do not think that this description will be very illuminating. Let us define each family T i (n).
Construction 5 (Family T 1 (3m + 1)). Start with T A,B,C where |A| = m, |B| = m + 2 and |C| = m − 1. Add an arbitrary set of tripartite edges so that no overused pairs are created and for every a ∈ A and c ∈ C there is a tripartite edge containing {a, c}. Remove all 3-edges of T A,B,C that contain a pair from S. Add all tripartite 3-edges that contain a pair from S. Thus S is precisely the set of overused pairs now. Add an arbtirary collection of tripartite 3-edges so that no new overused pair is created and for every a ∈ A and c ∈ C there is at least one tripartite edge containing {a, c}. (Note that if a belongs to a pair in S, then this condition is automatically satisfied.) Let S consist of pairs of vertices, containing at most one pair from V i × V i+1 for each i ∈ [3] so that if i ∈ {1, 3} and S contains both (x, y) ∈ V i−1 × V i and (y ′ , z) ∈ V i × V i+1 , then y = y ′ . (Thus 0 ≤ |S| ≤ 3; for example, if |S| = 3 then the pairs in S form either a 3-cycle or a path ending and starting in V 2 .) Remove all 3-edges from T V 1 ,V 2 ,V 3 that contain a pair in S. Add an arbitrary collection of tripartite 3-edges so that • each pair of S is contained in at least m − 1 added edges; • there are no other overused pairs than those from S; the pair {x ′ , y} is contained in exactly one tripartite edge.
We leave it to the reader to verify that each constructed 3-graph has minimum codegree m − 1. The following result implies that all these 3-graphs are F 3,2 -free.
Proposition 45. Let V be a set of vertices with tripartition V = V 1 ⊔V 2 ⊔V 3 . Let G be obtained from T V 1 ,V 2 ,V 3 by adding some set F of tripartite 3-edges and removing all 3-edges of T V 1 ,V 2 ,V 3 that contain a pair overused by F . Then G is F 3,2 -free.
Proof. By Proposition 35 we need only to check for copies of F 3,2 that contain two tripartite edges sharing an overused pair, say abc, ab ′ c ∈ F with a ∈ V 1 , c ∈ V 3 and b, b ′ ∈ V 2 . Each such F 3,2 has to be of form ac|bb ′ x for some x. Now, bb ′ x ∈ E(G) implies x ∈ V 3 . Since (a, c) is an overused pair, we have acx / ∈ E(G) by the definition of G. Thus we cannot have ac|bb ′ x, as desired.
Examples of 3-graphs in T 1 (n), T 2 (n) and T 3 (n) can be obtained by taking a 3-graph in respectively T (n + 5), T (n + 2) and T (n + 2), and deleting arbitrary vertices so that the parts have the desired sizes. However, note that, for example, not all 3-graphs in T 2 (n) ∪ T 3 (n) with S = ∅ come from T (n + 2) as there are (m + 1)-edge colourings of K m+1,m−1 (for m ≥ 4) and K m,m (for m ≥ 2) that do not extend to an (m + 1)-edge colouring of K m+1,m+1 .
We shall show that the 3-graphs in ∪ 3 i=1 T i (n) contain (as spanning subgraphs) all possible extremal configurations of order n. We know from our analysis in Section 4.1 that every extremal configuration G for the codegree problem consist of subgraph of T V 1 ,V 2 ,V 3 together with a set of tripartite 3-edges. Thus the minimum codegree is at most min(|V i | : i ∈ [3]). As δ 2 (G) = m − 1, we must have |V i | ≥ m−1 for every i ∈ [3]. We separate out into two cases according to whether or not we have equality for some i.
Proof. Without loss of generality, assume that |V 3 | = m − 1. By Lemmas 32 and 33, we have that Γ(x, x ′ ) ⊆ V 3 for every x, x ′ ∈ V 2 . The codegree condition δ 2 (G) ≥ m − 1 then implies that all 3-edges taking two vertices in V 2 and one in V 3 are in G. In addition, we have: Lemma 47. All 3-edges taking two vertices in V 3 and one in V 1 are in G.
Proof. Indeed, suppose that acc ′ / ∈ E(G) for some c, c ′ ∈ V 3 and a ∈ V 1 . Since Γ(c, a) contains at least m − 1 vertices and is contained in V 2 ∪ V 3 \ {c, c ′ } and since V 3 \ {c, c ′ } has size m − 3, it follows that there exist b, b ′ such that abc and ab ′ c are both in E(G). But then for all x ∈ V 3 \{c}, the 3-edge acx cannot be in G, for otherwise ac|bb ′ x. Likewise, for every y ∈ V 3 \ {x} we have that axy is missing from G. This implies d M (a) ≥ m−1
With Lemma 47 in hand, we can now turn our attention to the tripartite 3-edges of G. Write F for the tripartite 3-edges associated with the tripartition V 1 ⊔ V 2 ⊔ V 3 .
Proof. Suppose we had a ∈ V 1 , b, b ′ ∈ V 2 and c ∈ V 3 with abc, ab ′ c ∈ F . Then for all c ′ ∈ V 3 \{c} we must have acc ′ missing from G to prevent ac|bb ′ c ′ , contradicting Lemma 47.
Next we show that V 2 × V 3 does not contain overused pairs either.
Lemma 49. V 2 × V 3 contains no overused pairs Proof. Suppose we had a, a ′ ∈ V 1 , b ∈ V 2 and c ∈ V 3 such that abc and a ′ bc are both in F . We know that Γ(a, a ′ ) ⊆ V 2 (by Lemmas 32 and 33), so provided n is sufficiently large (which we are assuming) there is at least one b ′ ∈ V 2 \ {b} such that aa ′ b ′ ∈ E(G). But since we also have bb ′ c ∈ E(G) (as observed just before Lemma 47), this means bc|aa ′ b ′ , a contradiction.
In particular, all overused pairs from F come from V 1 × V 2 . Consider such an overused pair (a, b) with a ∈ V 1 and b ∈ V 2 . There exist c, c ′ ∈ V 3 such that abc and abc ′ are 3-edges of G. We have already shown that for any a ′ ∈ V 1 , a ′ cc ′ ∈ E(G). This implies aa ′ b / ∈ E(G) as otherwise we would have ab|a ′ cc ′ . The joint neighbourhood of a and b is thus (by Lemma 33) entirely contained in V 3 . The codegree condition then tells us this joint neighbourhood is exactly V 3 .
A consequence of this is that the set of tripartite 3-edges containing a is exactly the set of tripartite 3-edges containing b: if a was contained in any other tripartite 3-edge ab ′ c for some b ′ ∈ V 2 and c ∈ V 3 , we would have abc and ab ′ c both in F , so that (a, c) would be an overused pair from V 1 × V 3 , contradicting Corollary 48.
Thus if we define S to be the set of overused pairs, then it consists of vertex-disjoint pairs Proof. Assume without loss of generality that |V 1 | = m + 1 and |V 2 | = |V 3 | = m.
Let us show first that overused pairs are contained in tripartite 3-edges only.
Proof. Since (x, y) is an overused pair, there exist z, z ′ in V i+2 such that xyz, xyz ′ are 3-edges of G. Now Γ(z, z ′ ) ⊆ V i (by Lemmas 32 and 33) so that by the codegree condition Γ(z, z ′ ) contains at least m − 2 elements of |V i \ {x}|. For any such element x ′ , xx ′ y / ∈ E(G) for otherwise we would have xy|x ′ zz ′ . Now the joint neighbourhood of x and y is contained in V i ∪ V i+2 (Lemma 33) and has size at least m − 1, from which it follows that = Ω(n 2 ), contradicting Lemma 31. Thus if (x, y) is an overused pair from V i × V i+1 then Γ(x, y) ⊆ V i+2 .
We now turn our attention to showing that for each i ∈ {1, 2, 3}, the pair V i × V i+1 contains at most one overused pair. Proof. Suppose not. We know by Lemma 51 that for all a ′′ ∈ V i , neither of aa ′′ b and a ′ a ′′ b ′ are 3-edges of G.
Lemma 53. Suppose (a, b) and (a ′ , b) are overused pairs from V i × V i+1 . Then a = a ′ .
Proof. By Lemma 51, we know that Γ(a, b) and Γ(a ′ , b) are both subsets of V i+2 of size at least m − 1. In particular since |V i+2 | ≤ m + 1, we have that Γ(a, b) ∩ Γ(a ′ , b) is a subset of V i+2 of size at least m − 3. But for such b ′ and c, aa ′ b ′ / ∈ E(G), for otherwise we would have bc|aa ′ b ′ . Thus Γ(a, a ′ ) (which we know is a subset of V i+1 ) can contain at most o(m) vertices, contradicting our codegree assumption for n (and hence m) sufficiently large.
Taken together, the last two lemmas imply the following: Corollary 54. V 1 × V 2 and V 2 × V 3 each contain at most one overused pair.
We now prove analogues of Lemma 52 for V 3 × V 1 , to show that it too contains at most one overused pair.
For every distinct b, b ′ ∈ I we have that bb ′ c ∈ E(G) because otherwise we have bc|aa ′ b ′ . But then d M (c) ≥ |I| 2 , contradicting Lemma 31.
Lemma 56. Suppose (c, a) and (c ′ , a ′ ) are overused pairs from V 3 × V 1 . Then a = a ′ and c = c ′ . (In particular, V 1 × V 3 contains at most one overused pair.) Proof. Suppose not. The only case left over from Lemmas 53 and 55 is the case when both a = a ′ and c = c ′ , i.e. when we have vertex-disjoint overused pairs.
Thus provided |V 3 \ {c, c ′ }| ≥ 2, we have at least two distinct overused pairs from V 1 × V 2 , one involving a and the other a ′ . This contradicts Corollary 54.
We have thus shown that for every i ∈ [3], V i × V i+1 contains at most one overused pair. Let S consist of overused pairs. Lemma 57. If (x, y) ∈ V i × V i+1 is an overused pair and |V i | = m, then for every x ′ ∈ V i \ {x} there is exactly one z ∈ V i+2 with {x ′ , y, z} ∈ E(G).
Proof. The joint neighbourhood of x ′ , y lies inside V i−1 ∪ V i \ {x, x ′ }. Since δ 2 (G) ≥ m − 1, there must exists at least one z as required. Since {x ′ , y} is not an overused pair, this z is unique.
By Lemma 51, Γ(b ′ , c ′ ) is a subset of V 1 of size at least m − 1. As n is large, Γ(b ′ , c ′ ) must contain some a ′ = z(b ′′ ). But then a ′ c ′ b ′ , a ′ c ′ b ′′ ∈ E(G) so a ′ c ′ is an overused pair from V 1 × V 3 distinct from (a, c) (since c = c ′ ), contradicting Lemma 56.
Similarly, we have Lemma 59. Suppose (a, c) and (a ′ , b ′ ) are overused pairs from V 1 × V 3 and V 1 × V 2 respectively. Then a = a ′ .
Proof. Identical to the proof of Lemma 58, with V i playing the role of V i−1 .
The above lemmas show that if we add all edges from T V 1 ,V 2 ,V 3 to G, we obtain an element of T 3 (n), as claimed. 5 Turán density subject to a codegree constraint A natural variation of the Turán density and codegree density problems is the following. Definition 6. Let F be a family of nonempty 3-graphs, and let c ∈ [0, γ(F)].
The Turán number of F subject to the codegree constraint c is the function ex c (·, F) sending n ∈ N to the maximum number of 3-edges in an F-free n-vertex 3-graph with minimum codegree at least c(n − 2).
To the best of our knowledge, Lo and Markström [24] were the first to pose a question of the kind considered in Problem 5. They asked for the behaviour of ex c (n, F) when F is the 3-graph K − 4 . Problem 5 can be thought of as a way of viewing Problems 1 and 3 together within a common framework. In addition codegree constraints are rather natural in the context of 3-graphs, so that Problem 5 is appealing from an extremal hypergraph perspective.
For the Fano plane F 7 , Problem 5 is trivial from the work of Keevash and Sudakov [22], Füredi and Simonovits [15] and Keevash [20]: the extremal configurations for the Turán number and for the codegree threshold are identical for all n sufficiently large, so that for all c ∈ [0, 1/2], ex c (n, F 7 ) = ex(n, F 7 ) for all but finitely many n.
The situation is very different for F 3,2 , where codegree-extremal configurations have n 3 /18+ o(n 3 ) 3-edges, as we have shown, while the extremal configurations have n 3 /27 + o(n 3 ) 3-edges, i.e. about one and a half times as many. A first step towards the resolution of Problem 5 for F 3,2 would be to identify the asymptotic behaviour of ex c (n, F 3,2 ) for c in [0, 1/3].
We believe that in this case the answer is obtained by shifting weight in a continuous fashion between the three parts of a T A,B,C construction, and so to move from Construction 1 (when |C| = δ 2 = 0) to Construction 2 (when the three parts have size n/3 + o(n)). This gives the following: Conjecture 2. Let G be an F 3,2 -free 3-graph on n vertices with minimum codegree at least cn, for some c : 0 < c < 1/3. Then