{'fraction_non_alphanumeric': 0.03931730506955539, 'fraction_numerical': 0.014144877839691384, 'mean_word_length': 3.989113530326594, 'pattern_counts': {'":': 0, '<': 1, '<?xml version=': 0, '>': 2, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 7, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
A complete hierarchy for the pure state marginal problem in quantum mechanics

Clarifying the relation between the whole and its parts is crucial for many problems in science. In quantum mechanics, this question manifests itself in the quantum marginal problem, which asks whether there is a global pure quantum state for some given marginals. This problem arises in many contexts, ranging from quantum chemistry to entanglement theory and quantum error correcting codes. In this paper, we prove a correspondence of the marginal problem to the separability problem. Based on this, we describe a sequence of semidefinite programs which can decide whether some given marginals are compatible with some pure global quantum state. As an application, we prove that the existence of multiparticle absolutely maximally entangled states for a given dimension is equivalent to the separability of an explicitly given two-party quantum state. Finally, we show that the existence of quantum codes with given parameters can also be interpreted as a marginal problem, hence, our complete hierarchy can also be used.

F or a given multiparticle quantum state φ j i it is straightforward to compute its marginals or reduced density matrices on some subsets of the particles. The reverse question, whether a given set of marginals is compatible with a global pure state, is, however, not easy to decide. Still, it is at the heart of many problems in quantum physics. Already in the early days, it was a key motivation for Schrödinger to study entanglement 1 , and it was recognized as a central problem in quantum chemistry 2 . There, often additional constraints play a role, e.g., if one considers fermionic systems. Then, the anti-symmetry leads to additional constraints on the marginals, generalizing the Pauli principle 3,4 . A variation of the marginal problem is the question of whether or not the marginals determine the global state uniquely or not [5][6][7] . This is relevant in condensed matter physics, where one may ask whether a state is the unique ground state of a local Hamiltonian 8,9 . Many other cases, such as marginal problems for Gaussian and symmetric states 10,11 and applications in quantum correlation 12 , quantum causality 13 , and interacting quantum many-body systems 14,15 have been studied.
With the emergence of quantum information processing, various specifications of the marginal problem moved into the center of attention. In entanglement theory, a pure two-particle state is maximally entangled, if the one-particle marginals are maximally mixed. Furthermore, absolutely maximally entangled (AME) states are multiparticle states that are maximally entangled for any bipartition. This makes them valuable ingredients for quantum information protocols 16,17 , but it turns out that AME states do not exist for arbitrary dimensions, as not always global states with the desired mixed marginals can be found [18][19][20][21] . In fact, also states obeying weaker conditions, where a smaller number of marginals should be maximally mixed, are of fundamental interest, but in general it is open when such states exist [22][23][24] . More generally, the construction of quantum error-correcting codes, which constitute fundamental building blocks in the design of quantum computer architectures [25][26][27] , essentially amounts to the identification of subspaces of the total Hilbert space, where all states in this space obey certain marginal constraints. This establishes a connection to the AME problem, which consequently was announced to be one of the central problems in quantum information theory 28 .
In this paper, we rewrite the marginal problem as an optimization problem over separable states. Here and in the following, the term marginal problem usually refers to the pure state marginal problem in quantum mechanics. This rewriting allows us to transform the nonconvex and thus intractable purity constraint into a complete hierarchy of conditions for a set of marginals to be compatible with a global pure state. Each step is given by a semidefinite program (SDP), the conditions become stronger with each level, and a set of marginals comes from a global state, if and only if all steps are passed. There are at least two advantages of writing the marginal problem as an SDP hierarchy: First, the symmetry in the physical problem can be directly incorporated to drastically simplify the optimization (or feasibility) problem. Second, many known efficient and reliable algorithms are known for solving SDPs 29 , which is in stark contrast to nonconvex optimization. To show the effectiveness of our method, we consider the existence problem of AME states. By employing the symmetry, we show that an AME state for a given number of particles and dimension exists, if and only if a specific two-party quantum state is separable. In fact, this allows us to reproduce nearly all previous results on the AME problem 30 with only few lines of calculation. Finally, we show that our approach can also be extended to study the existence problem of quantum codes.

Results
Connecting the marginal problem with the separability problem. The formal definition of the marginal problem is the following: Consider an n-particle Hilbert space H ¼ N n i¼1 H i , and let I & fIjI & ½n ¼ f1; 2; ; ngg be some subsets of the particles, where the reduced states ρ I are known marginals. Then, the problem reads find φ j i s:t: Here, I c = [n]⧹I denotes the complement of the set I. Before explaining our approach, two facts are worth mentioning: First, if the global state φ j i φ h j is not required to be pure, then the quantum marginal problem without purity constraint is already an SDP. Second, if the given marginals are only one-body marginals, that is I ¼ ffigji 2 ½ng, the marginals are nonoverlapping and the problem in Eq. (1) was solved by Klyachko 31 . For overlapping marginals, however, the solution is more complicated, and this is what we want to discuss in this work.
The main idea of our method is to consider, for a given set of marginals, the compatible states and their extensions to two copies. Then, we can formulate the purity constraint using an SDP. First, let us introduce some notation. Let C be the set of global states (not necessarily pure) that are compatible with the marginals, i.e., Then, we define C 2 to be the convex hull of two copies of the compatible states where the p μ form a probability distribution. We denote the two parties as A and B, and each of them owns an n-body quantum system (see Fig. 1).
To impose the purity constraint, we take advantage of the wellknown relation 32 where ρ A and ρ B are arbitrary quantum states, and V AB is the swap operator between parties A and B, i.e., which acts on a state Φ AB ¼ P i;j ω ijkl i; j j i k; l h j as V AB Φ AB ¼ P i;j ω ijkl j; i j i k; l h j. For a state Φ AB in C 2 this implies that Fig. 1 Two-party extension for the marginal problem. In the marginal problem, one aims to characterize the pure states φ on n particles, which are compatible with given marginals. The key idea of our approach is to drop the purity constraint and to consider mixed states ρ with the given marginals. Then, the purity is enforced by considering a two-party extension Φ AB . Furthermore, equality in Eq. (6) is attained if and only if all ρ μ are pure states. This leads to our first key observation: there exists a pure state in C if and only if max Φ AB 2C 2 TrðV AB Φ AB Þ ¼ 1.
What remains to be done is the characterization of the set C 2 , then we can formulate the quantum marginal problem as an optimization problem over this set. This can be done by taking advantage of the separability property 32 of the states in C 2 with respect to the bipartition (A|B).
Theorem 1 There exists a pure quantum state φ j i that satisfies Tr I c ð φ j i φ h jÞ ¼ ρ I for all I 2 I if, and only if, the solution of the following convex optimization is equal to one, where SEP denotes the set of separable states w.r.t. the bipartition (A|B), A I c denotes all subsystems A i for i ∈ I c , and similarly for B I c .
Proof On the one hand, if there exists a pure state φ j i φ h j 2 C, one can easily verify that (8) and (9) as well as TrðV AB Φ AB Þ ¼ 1.
On the other hand, if the solution of Eq. (7) is equal to one, then the separability constraint and Eq. (6) imply that Φ AB must be of the form 33 Writing Without loss of generality, we assume that all p μ are strictly positive and we want to show that all σ ðμÞ I ¼ ρ I , which will imply that each jψ μ i is a pure state with the desired marginals. Let X be any Hermitian matrix such that TrðXρ I Þ ¼ 0, then Eq. (11) and the relation Tr½ðX XÞðσ σÞ ¼ ½TrðXσÞ 2 imply that X μ p μ Tr Xσ By noting that TrðXσ ðμÞ I Þ are real numbers, we get that TrðXσ ðμÞ I Þ ¼ 0, for all μ and all X such that TrðXρ I Þ ¼ 0. Thus, all σ ðμÞ I are proportional to ρ I and, together with Trðρ I Þ ¼ Trðσ Before proceeding further, we would like to add a few remarks. First, in Theorem 1 the constraint in Eq. (9) can be replaced by a stronger condition This is because for any (not necessarily separable) quantum state Φ AB satisfying TrðV AB Φ AB Þ ¼ 1, Eq. (13) implies the validity of Eq. (9). Hence, this replacement will lead to an equivalent result as in Theorem 1. However, when considering relaxations of the optimization in Eq. (7) by replacing the separability constraint in Eq. (8) with some entanglement criteria, Eq. (13) may be strictly stronger for certain marginal problems. Second, if one finds that TrðV AB Φ AB Þ ¼ 1, this is equivalent to V AB Φ AB = Φ AB , as the largest eigenvalue of V AB is one. Physically, this means that Φ AB is a two-party state acting on the symmetric subspace only. Hence, Theorem 1 is also equivalent to the feasibility problem Furthermore, any feasible state Φ AB can be used for constructing the global state φ j i with the desired marginals, as the proof of Theorem 1 implies any pure state in the separable decomposition of Φ AB can give a desired global state.
Third, the separability condition in the optimization Eq. (8) is usually not easy to characterize, hence relaxations of the problem need to be considered. The first candidate is the positive partial transpose (PPT) criterion 34,35 , which is an SDP relaxation of the optimization in Eq. (7). The PPT relaxation provides a pretty good approximation when the local dimension and the number of parties are small. In the following, inspired by the symmetric extension criterion 36 , we propose a multi-party extension method and obtain a complete hierarchy for the marginal problem.
The hierarchy for the marginal problem. In order to generalize Theorem 1, we first need to extend C 2 in Eq. (3) from two to an arbitrary number of copies of ρ. That is, we define C N ¼ convfρ N jρ 2 Cg. Second, we introduce the notion of the symmetric subspace. We denote the N parties as A, B, …, Z, and each of them owns an n-body quantum system. For any where S N is the permutation group over N symbols and V Σ are the corresponding operators on the N parties A, B, …, Z (see Fig. 2). Let P þ N denote the orthogonal projector onto the symmetric subspace of H N . P þ N can be explicitly written as In particular, for two parties we have the well-known relation Hereafter, without ambiguity, we will use P þ N to Fig. 2 Complete hierarchy for the marginal problem. In order to formulate the hierarchy for the marginal problem, one extends the two copies in Fig. 1 to an arbitrary number of copies N. If the marginal problem has a solution φ , then there are multi-party extensions Φ AB⋯Z in the symmetric subspace specified by V Σ ¼ V n σ for any number of copies, obeying some semidefinite constraints. Suppose that there exists a pure state ρ 2 C. It is easy to see that Here, the separability can be understood as either full separability or biseparability, since they are equivalent in the symmetric subspace 33 . Relaxing Φ AB⋯Z ∈ SEP, we obtain a complete hierarchy for the quantum marginal problem: Theorem 2 There exists a pure quantum state φ j i that satisfies Tr I c ð φ j i φ h jÞ ¼ ρ I for all I 2 I if and only if for all N ≥ 2 there exists an N-party quantum state Φ AB⋯Z such that Each step of this hierarchy is a semidefinite feasibility problem, and the conditions become more restrictive if N increases.
The proof of Theorem 2 is shown in the "Methods" section. Notably, we can add any criterion of full separability, e.g., the PPT criterion for all bipartitions, as extra constraints to the feasibility problem. Then, Theorem 2 still provides a complete hierarchy for the quantum marginal problem. In addition, the quantum marginal problems of practical interest are usually highly symmetric. These symmetries can be utilized to largely simplify the problems in Theorems 1 and 2. Indeed, taking advantage of symmetries is usually necessary for practical applications, because the general quantum marginal problem is QMA-complete 37,38 . Notably, even for non-overlapping marginals, despite recent progress in refs. [39][40][41] , it is still an open problem whether there exists a polynomial-time algorithm. In the following, we illustrate how symmetry can drastically simplify quantum marginal problems with the existence problem of AME states.
Absolutely maximally entangled states. We first recall the definition of AME states. An n-qudit state ψ j i is called an AME state, denoted as AME(n, d), if it satisfies where I r ¼ fI & ½nj I j j ¼ rg and r = ⌊n/2⌋. Thus, Eq. (14) implies that an AME(n, d) exists if and only if the following problem is feasible, Direct evaluation of the problem is usually difficult, because the dimension of Φ AB is d 2n × d 2n , which is already very large for the simplest cases. For instance, for the 4-qubit case, the size of Φ AB is 256 × 256.
To resolve this size issue, we investigate the symmetries that can be used to simplify the feasibility problem. Let X denotes the set of Φ AB that satisfies the constraints in Eqs. (26), (27), and (28). If we find a unitary group G such that for all g ∈ G and Φ AB 2 X we have that gΦ AB g y 2 X: ð29Þ Then, the convexity of X implies that we can add a symmetry constraint to the constraints in Eqs. (26), (27), and (28), namely, In the following, we will show that the symmetries of the set of AME states (if they exist for given n and d) are restrictive enough to leave only a single unique candidate for Φ AB , for which separability needs to be checked. The set of AME(n, d) is invariant under local unitaries and permutations on the n particles, so by Theorem 1 (or by direct verification) the following two classes of unitaries satisfy Eq. (29), π π 8 π 2 S n ; ð32Þ where π = π(A 1 , A 2 , …, A n ) = π(B 1 , B 2 , …, B n ) denotes the permutation operators on H A and H B . Note that the U i in Eq. (31) can be different. First, let us view V AB and Φ AB as V 12…n and Φ 12…n , where i labels the subsystems A i B i . Hereafter, without ambiguity, we will omit the subscripts of for simplicity. From this perspective, V AB can be written as V ⊗n , and the symmetries in Eqs. (31) and (32) can be written as N n i¼1 ðU i U i Þ for U i ∈ SU(d) and Π = Π(A 1 B 1 , A 2 B 2 , …, A n B n ) for Π ∈ S n , respectively. According to Werner's result 32 , a (U ⊗ U)-invariant Hermitian operator must be of the form α1 þ βV with α; β 2 R. This implies that a N n i¼1 ðU i U i Þ Â Ã -invariant state must be a linear combination of operators of the form In addition, we take advantage of the permutation symmetry under Π ∈ S n to write any invariant Φ AB as where P represents the sum over all possible permutations that give different terms, e.g., Inserting this ansatz in Eqs. (27) and (28) one can show by brute force calculation that the x i are uniquely determined and given by where we use the convention that ð i j Þ ¼ 0 when j < 0 or j > i; see Supplementary Note 1 for details. This means that the two-party extension under the symmetries is independent of the specific AME state, which is an interesting structural result considering that there exist even infinite families of AME(n, d) states that are not SLOCC equivalent 42 . Together with Theorem 1, this result implies that an AME state exists if and only if Φ AB is a separable quantum state.
Theorem 3 An AME(n, d) state exists if and only if the operator Φ AB defined by Eqs. (35) and (36) is a separable state w.r.t. the bipartition (A|B) = (A 1 A 2 …A n |B 1 B 2 …B n ).
To check the separability of Φ AB , we first consider the positivity condition and the PPT condition. It is easy to see that Φ AB can be written as and Φ T B AB can be written as where Here p i and q i are the eigenvalues of AB , respectively. Then, we can simplify the positivity condition Φ AB ≥ 0 and the PPT condition Φ for all i = 0, 1, 2, …, n. Note that the latter inequality is trivial for i ≤ r. The explicit form of p i and q i and the proof of the conditions in Eqs. (40) and (41) are shown in Supplementary Note 2. The positivity and PPT conditions can already rule out the existence of many AME states. Actually, they can reproduce all the known nonexistence results 30 except AME(7, 2) 20 . To get a higher-order approximation, we provide a general framework for performing the symmetric extension in Supplementary Notes 3 and 4.
As the open problem of the existence of AME(4, 6) is of particular interest in the quantum information community 28,43 , we explicitly express it as the following corollary.
Corollary 1 An AME(4, 6) state exists if and only if the quantum state is separable, or equivalently, is separable w.r.t. bipartition (A|B). At the moment, we are unable to decide separability of these states; in Supplementary Note 5 we provide a short discussion of this problem.
Quantum codes. As another application, we show that our method can also be used to analyze the existence of quantum error-correcting codes. For simplicity, we only consider pure quantum codes 44 in the text; see "Methods" for the general case. Our starting point is the fact that pure quantum codes are closely related to m-uniform states 18 . More precisely, an ((n, K, m+1)) d pure code exists if and only if there exists a K-dimensional sub- such that all states in Q are m-uniform, i.e., for all φ j i 2 Q where I m ¼ fI 2 ½nj I j j ¼ mg and I c = [n]⧹I. The existence of ((n, 1, m+1)) d pure codes reduces to the existence of m-uniform states, for which the methods from the last section are directly applicable. Here, we show that the existence of ((n, K, m+1)) d pure codes can still be written as a marginal problem if K > 1. To do so, we define an auxiliary system H 0 ¼ C K and let . Now, we can write the existence of ((n, K, m+1)) d pure codes as a marginal problem on e H. Lemma 1 A quantum ((n, K, m+1)) d pure code exists if and only if there exists a quantum state Q j i in e H such that where I c is still defined as {1, 2, …, n}⧹I.
Proof We first show the necessity part. Suppose that a ((n, K, m+1)) d code with corresponding subspace Q exists. We define an where f k j ig K k¼1 and f k L j ig K k¼1 are orthonormal bases for H 0 and Q, respectively. Then for any pure state a j i in H 0 , ffiffiffi ffi K p ajQ h i 2 Q. Hence, Eq. (44) implies that for all a j i in H 0 , which in turn implies Eq. (45). To prove the sufficiency part, let Q be the space generated by the pure states φ a ¼ ffiffiffi ffi K p ajQ h i for all a j i in H 0 . Then, Eq. (45) implies that all φ a are m-uniform states. Furthermore, from Thus, Theorem 1 gives a necessary and sufficient condition for the existence of ((n, K, m+1)) d pure codes.
where SEP denotes the set of separable states w.r.t. the bipartition (A|B) = (A 0 A 1 ⋯ A n |B 0 B 1 ⋯ B n ), V AB is the swap operator between e H A and e H B , and A I c denotes all subsystems A i for i ∈ I c . Furthermore, the multi-party extension and symmetrization techniques that we developed for AME states can be easily adapted to the quantum error-correcting codes. For instance, the PPT relaxation can be written as a linear program and the symmetric extensions can be written as SDPs. An important difference is that the symmetrized Φ AB for quantum error-correcting codes is no longer uniquely determined by the marginals in general. Finally, we would like to mention that Lemma 5 is of independent interest on its own. For example, Eq. (45) implies that Kd m ≤ ffiffiffiffiffiffiffiffi Kd n p , as . This provides a simple proof for the quantum Singleton bound 44,45 K ≤ d n−2m for pure codes.

Discussion
We have shown that the marginal problem for multiparticle quantum systems is closely related to the problem of entanglement and separability for two-party systems. More precisely, we have shown that the existence of a pure multiparticle state with given marginals can be reformulated as the existence of a two-party separable state with additional semidefinite constraints. This allows for further refinements: First, one may use the multiparty extension technique to develop a complete hierarchy for the quantum marginal problem. Second, one can use symmetries of the original marginal problem, to restrict the search of the twoparty separable state further. For the AME problem, this allows us to determine a unique candidate for the state, and it remains to check its separability properties. Finally, the approach can be extended to characterize the existence of quantum codes.
Our work provides new insights into several subfields of quantum information theory. First, it may provide a significant step towards solving the problem of the existence of the AME(4, 6) state or quantum orthogonal Latin squares, a problem which has been highlighted as an outstanding problem in quantum information theory 28 . Second, there are already a variety of results on the separability problem, and in the future, these can be used to study marginal problems in various situations. Finally, it would be interesting to extend our work to other versions of the marginal problem, e.g., in fermionic systems or with a relaxed version of the purity constraint. We believe that our approach can also lead to progress in these cases.

Methods
Proof of Theorem 2. To prove Theorem 2, we take advantage of the following lemma, which can be viewed as a special case of the quantum de Finetti theorem 46 .
Lemma 2 Let ρ N be an N-party quantum state in the symmetric subspace P þ N , then there exists a k-party quantum state i.e., a fully separable state in P þ k , such that where Á k k is the trace norm and D is the local dimension. The necessity part of Theorem 2 is obvious. Hence, we only need to prove the sufficiency part, i.e., that the existence of an N-party quantum state Φ AB⋯Z for arbitrary N implies the existence of φ Further, Lemma 7 implies that there exist separable states e Φ N AB such that As the set of quantum states for any fixed dimension is compact, we can choose a convergent subsequence Φ N i AB of the sequence Φ N AB . Thus, Eq. (54) implies that Thus, Eqs. (52) and (53) and the fact that the set of separable states is closed imply that Φ AB satisfies all constraints in Eqs. (14), (15), and (16). Then, Theorem 2 follows directly from Theorem 1.
General quantum codes. In general, a quantum ((n, K, m+1)) d code exists if and where ρ I are marginals that are arbitrary but independent of φ j i, I m ¼ fI 2 ½nj I j j ¼ mg, and I c = [n]⧹I = {1, 2, …, n}⧹I. Similar to the case of pure codes, we can prove the following lemma.
Lemma 3 A quantum ((n, K, m+1)) d code exists if and only if there exists a quantum state Q j i in e H and marginal states ρ I such that where e and I c is defined as [n]⧹I = {1, 2, …, n}⧹I.
If the marginals ρ I are given like in the case of pure codes, the problem reduces to a marginal problem. However, to ensure the existence of ((n, K, m+1)) d codes, an arbitrary set of marginals is sufficient. This makes the problem no longer a marginal problem, however, we can circumvent this issue by observing that Eq. (57) is equivalent to for all M 0 such that TrðM 0 Þ ¼ 0. Moreover, we can choose an arbitrary basis B for fM 0 jTrðM 0 Þ ¼ 0; M y 0 ¼ M 0 g. Then, with the general result on rank-constrained optimization from ref. 47 , we obtain the following theorem, and similar to the AME existence problem, a complete hierarchy can be constructed using the symmetric extension technique.
Proposition 2 A quantum ((n, K, m+1)) d code exists if and only if there exists for all I 2 I m and M A 0 2 B, where the SEP means the separability with respect to the bipartition (A|B) = (A 0 A 1 ⋯ A n |B 0 B 1 ⋯ B n ), V AB is the swap operator between e H A and e H B , A I c denotes all subsystems A i for i ∈ I c , and 1 A c 0 denote the identity operator on AB⧹A 0 = A 1 A 2 ⋯ A n B 0 B 1 B 2 ⋯ B n .
By noticing that the set of ((n, K, m+1)) d (pure or general) codes, or rather, the set of states Q j i, is invariant under local unitaries and permutations on the bodies 123 ⋯ n, we can assume that Φ AB is invariant under the following two classes of unitaries id 0 π id 0 π: ð62Þ for all U 0 ∈ SU(K), U i ∈ SU(d), and π ∈ S n . Thus, the symmetrized Φ AB is of the form y i PfV i 1 ðnÀiÞ g; ð63Þ for x i ; y i 2 R. Hence, all the techniques we developed for AME states can be easily adapted to the quantum error-correcting codes. For example, the PPT relaxation can be written as a linear program and the symmetric extension can be written as SDPs.

Data availability
Data sharing not applicable to this article as no datasets were generated or analyzed during the current study.

Code availability
The codes used for this study are available from the corresponding author upon reasonable request.