{'fraction_non_alphanumeric': 0.03758909591096661, 'fraction_numerical': 0.014830561460547705, 'mean_word_length': 4.1172254927054, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, '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}}
The invariant space of multi-Higgs doublet models

In a model with more than one scalar doublet, the parameter space encloses both physical and unphysical information. Invariant theory provides a detailed description of the counting and characterization of the physical parameter space. The Hilbert series for the 3HDM is computed for the first time using partition analysis, in particular Omega calculus, giving rise to the possibility of a full description of its physical parameters. A rigorous counting of the physical parameters is given for the full class of models with N scalars as well as a decomposition of the Lagrangian into irreducible representations of SU(N). For the first time we derive a basis-invariant technique for counting parameters in a Lagrangian with both basis-invariant redundancies and global symmetries.


Introduction
In high-energy physics symmetries play a fundamental role in model building of both theory and phenomenology multi-scalar theories. Nevertheless, we are often interested on the invariants of these symmetries as they may relate to gauge invariance, physical parameters or the construction of the Lagrangian. The scalar potential has been thoroughly studied in the physics literature, where various basis-invariant methods [1][2][3][4] and more group-theoretical methods such as billinears [5][6][7][8][9][10][11][12][13][14] were used. Recent work has developed a new perspective on the group structure of the parameter space by using invariant theory. The characterization of invariants has also been instrumental to study physical parameters and CP violation. The Hilbert series of the 2HDM was first obtained in [15] and later studied in the context of CP violation in [16]. With this technique, the complete roadmap to the basis-invariant description of the 2HDM built on invariant theory was achieved in [17].
Invariant theory, a field of algebraic geometry, concerns the study of precisely these invariants and was developed by many prominent mathematicians such as David Hilbert, Emmy Noether and physicist Hermann Weyl. It has been used in the context of string theory [18]. More recently, an excellent review of these methods was given in [19] along with strategies for handling couplings with derivatives in EFTs. As a theory, it also provides a framework for a full group-theoretical perspective of the parameter space.
As complete as it may be, invariant theory relies heavily on the computation of a formal quantity, known as the Hilbert series. In it lies the full count and characterization of any physical parameter in a theory. A shortcoming of this strategy is the sometimes insurmountable calculation of a very large number of residues of multivariate integrals. Here, we introduce a technique developed by P. MacMahon [20], later called Omega calculus. With it, many challenging complex integrals become attainable, as we will show with the very complicated case of the 3HDM.
By using several results obtained throughout the years in the mathematical literature, we extract properties for the class of NHDM (N Higgs Doublet models). In particular, we show that the Hilbert series is not needed to compute the number of physical parameters in multi-Higgs doublet models.
With the knowledge on how the vector space of a Lagrangian decomposes in irreducible representations of any group, we derive a technique that counts the number of parameters in a Lagrangian with both basis-invariant redundancies and global symmetries. This method does not require knowledge of invariant theory, only of the group structure of the symmetry group G.
2 Group structure of the scalar potential There are essentially two perspectives regarding the group structure of the scalar sector of a NHDM: the fields and their representations [9,12], and the parameter space and its representation [15,16], both under a basis transformation group. We will follow the latter by decomposing the parameter space into irreducible representations of SU(N ). Assigning this structure will allow us to build the invariant analogue of the parameter space under basis transformations. In other words, build the physical parameter space of any multi-Higgs doublet model.
In the most general NHDM, the Lagrangian potential can be written as where the matrices follow hermiticity and symmetry properties µ ij = µ * ji and z ij,kl = z kl,ij = z * ji,lk . It is well known that eq. (2.1) is not unique and that we can always perform a basis transformation SU(N ) such that we generate the same physical theory. Furthermore, the fields transform under the fundamental representation r f . Thus, µ ij and z ij,kl transform as where Sym denotes essentially the symmetry property of z ij,kl . With this decomposition we find where we follow the well known group theory result r ⊗ r = Sym 2 (r) ⊕ Alt 2 (r), where Sym and Alt are respectively the symmetric and antisymmetric parts of the tensor product. In section 7 we will revisit eq. (2.3). The results above point to a full decomposition of the parameter space of the scalar potential in terms of irreducible representations of SU(N ). Thus, we define the vector space of the parameters as V , defined as the space that transforms with The dimension dim V is the number of parameters in the potential. This can be readily computed from eq. (2.4). With dim r f = N , the number of doublets, and as the number of parameters in the NHDM.
Example. In the 2HDM we may decompose and similarly we decompose Then the vector space of parameters V transforms as and dim V = 14, the number of parameters in the 2HDM.
The decomposition of V is instrumental to the analysis of the physical parameters of the NHDM. Throughout this paper we won't concern ourselves with the structure of the representation themselves, as it is not needed for any of our results. Nevertheless, a systematic approach to this calculation is given in ref. [16] with the use of projectors.

The invariant space formalism
The decomposition of V into irreducible representations provides a framework for how a group G acts on V . Nevertheless, no physical parameter is given in experiment in matrix form. The computation of physical parameters is often built on contracted tensors for which the answer is a number, a polynomial in the Lagrangian parameters [1]. Thus, it is important to introduce the notion of polynomial rings and their properties.
We will be rather formal with our notation in order to compare with the mathematical literature. Consequently we will provide examples to map the formalism to the analysis of the NHDM matrices µ ij and z ij,kl .

The ring of invariants
Let us consider a vector space V as the space with dimension dim V spanned by the basis x 1 , . . . , x n . The polynomial ring K[V ] = K[x 1 , . . . , x n ] is then composed by polynomial functions in x i and span every algebraic combination of such parameters in the field K. We will consider the field K to be the complexes C. Furthermore, we consider the action of a group G on V , for which each element g ∈ G has a representation ρ(g) acting on V . We will abuse the notation by stating g instead of ρ(g). Then we may define the ring of There are several noteworthy explanations so far. We begin with a space V to which we apply the group G. Then, we collect the invariants of the action of G such that the remaining space is generated by elements called the primary invariants. We already see that K[V ] G ⊆ K[V ], i.e. the invariant ring is contained in the original one. The dimension of a ring is called the Krull dimension and it is the minimum number of generators of the ring. The dimension of the initial ring K[V ] is given by while for the ring of invariants we define the Krull dimension as Thus, r ≤ n. The Krull dimension of K[V ] G also has a crucial interpretation, it is the number of physical parameters of the theory and it will be a meaningful quantity throughout this paper.
Example. Let us consider a scalar potential with only µ ij . Then, V = A, the space of 2 × 2 Hermitian matrices and µ ∈ A. The dimension of V is then dim V = 4, the parameters µ 11 , µ 12 , µ * 12 , µ 22 . Hence, the polynomial ring in the complexes is consisting on all of the polynomials in the parameters. If we choose to study the invariants under basis transformations G = SU(2) we may define the invariant ring as The ring of invariants K[V ] G is solely responsible for all the physical information in a theory. Knowing its generators is equivalent to knowing all of the physical parameters, their CP properties, and in principle, even their impact on physical processes. 1 To this end, we need a tool to compute the generators of the invariant space, the Hilbert series.
For simplicity, while keeping some of the common mathematical notation, we will interchange K[V ] with R and K[V ] G with R G .

The Hilbert series
The Hilbert series is a very powerful tool for the characterization of K[V ] G , the ring of invariants. The series itself is given by where dim(R G k ) are the number of invariants of degree k which are invariant under the group G and t is a token variable describing the degree of the invariants. Contrary to the primary invariants (generators), these need not be independent, as they total the number of invariants.
The Hilbert series can also be written in a closed form, generally as where P (t) is a polynomial. The denominator of the Hilbert series describes the degree and number of invariants under the action of a group G. In eq. (3.7) we count d 1 invariants of degree one, d 2 invariants of degree two, etc. From eq. (3.7) we can read several properties of the invariant ring K[V ] G . In the context of the Hilbert series, the Krull dimension r is such that the limit is neither infinite nor zero. Alternatively, this also means that in eq. (3.7) we can read the dimension as In other words, the minimum number of invariants needed to generate the invariant space is given by the Krull dimension, r. As such, we can always expand the Hilbert series as where the significance of γ and τ will be more clear later on.
Example. In the 2HDM the Hilbert series has been fully computed [16], both the ungraded (all token variables equal t) and the multi-graded (a token variable for each representation).
Excluding the three singlets of eq. (2.9), the ungraded series is given by 11) or in closed form where we can read that K[V ] G is generated by 4 degree two, 3 degree three and 1 degree four generators. Along with the three singlets, this yields a total of 11 physical parameters. We can also expand it around t = 1 such that

Molien series and the Weyl integration formula
Until now we have just stated general properties of invariant rings and Hilbert series but made no comment on its computation. For this, we separate two cases.
Let G be a finite group and ρ(g) a representation in GL n . Then we may compute the Molien formula as . (3.14) We note that although we sum over the elements of the group, we need only to sum over one element for each conjugacy class times the number of elements in it. Similarly, one can compute the Hilbert series for an infinite group. Let G be a reductive group, e.g. SU(N ), SO(N ), SL(N ). Then we define the Weyl integration formula to be , (3.15) where dµ G stand for the Haar measure. A number of them can be found in [21] for Lie groups, where it is defined as where α + are the positive roots of the group. Finally, we add the notion of plethystic exponential and plethystic logarithm, which as far as we know was first introduced in [18]. The plethystic exponential is defined as where χ r (z k j ) is the character of the representation r = ρ. It can be interpreted with some trivial steps to be The plethystic logarithm is defined as where µ(k) is the Möbius function. The significance of eq. (3.19) as a series is in the counting of possible primary invariants in the positive terms and the determination of the syzygies in negative terms, and has been extensively discussed in [18].
In the context of Lie groups we will always take the integration to be over the maximal torus T of the group G. This will be the Abelian group which intersects all conjugacy classes of G and will greatly simplify our analysis.

General properties
Until now we have discussed several known results in invariant theory as it applies to physics problems. Here we present a collection of formal results in invariant theory. These will be instrumental to describe the class of models with more than one scalar. As with the more formal sections of this text, we will give an example at the end to guide the reader through the properties of the Hilbert series.
We have stated before that we will consider to be working on K = C, unless stated otherwise. We find that the characteristic of the field C is char(C) = 0. In characteristic zero fields it suffices to say that for K[V ] G to be finitely generated, G must be reductive. All semi-simple groups, finite groups and tori are examples, as described in [22]. Examples of semi-simple groups are SL(N ), SU(N ) and O(N ).
where r is the Krull dimension and q ∈ Z as shown in [24].
In other words, eq. (3.20) also implies that the numerator of the Hilbert series should be palindromic. [25] states that for almost all representations of a connected,

Theorem 2. A theorem in
where q is defined in eq. (3.20) and dim V is the dimension of our initial space.
We will always assume that this is true. The computation of the Hilbert series will confirm it at the end.
Remark. The degree of the Hilbert series is defined by [25] deg

22)
with q defined in eq. (3.20). Thus, it follows that for almost all representations of G we have that This is an important result which will enable us to know how to find the correct form of the Hilbert series at the end of the computation. [26] confirms that for all representations

Theorem 3. A theorem of Knop and Littelmann
In [25] another important corollary follows.
The most important result we present here is given in [27].
Remark. If G is semi-simple and connected, the Krull dimension r is given by where the arrow means "for almost all representations of G", in accordance with eq. (3.21).
Finally we can state a non-uniqueness property of the Hilbert series. Let H 1 (K[V ] G , t) be a Hilbert series respecting all of the above properties. Then there may exist H 2 (K[V ] G , t) with the same properties. This result is discussed in [28] along with an algorithm to search for an optimal solution which is often, but not always, the minimal solution. We will always search for the minimal solution, i.e. the one where the degrees of the Hilbert series are minimal. In [22] the author exemplifies and While in another context, eqs. (3.27)-(3.28) serve as an example of the Hilbert series nonuniqueness.
Example. Let H(K[V ] G , t) be the Hilbert series of the 2HDM, written in eq. (3.12). Theorem 1 states that its numerator is palindromic, which is true. While all of Popov's results are true for all but a finite number of representations, the 2HDM is one of them, i.e. the representation 2(3) ⊕ 5 is one of the "almost all representations". Then,

Computing the Hilbert series
While the computation of the Hilbert series by the Molien formula for finite groups enjoys a large amount of software and information, the computation for infinite groups is much less straightforward. Calculating eq. (3.15) is usually achieved by the use of the plethystic exponential as the integrand using the characters of the representations of G. In [19] there is a collection of such character functions in the appendix. Ungraded and multi-graded Hilbert series are then computed with the residue theorem and the fact that as we know that Tr (a ⊕ b) = Tr(a) + Tr(b). Nevertheless, the use of the residue theorem has a stark impact on the complexity of the computation. For large representations or multivariate integrations the closed form of the Hilbert series may take too long to compute, too much memory or even be impossible with current technology. This problem has since prevented the use of invariant theory in physics for more complicated problems.

Omega calculus
Combinatorics has been a constant intersection with invariant theory. In more recent years, the same field has been essential for the computation of invariants.
In the work of Percy MacMahon [20] the author illustrates partition analysis by solving combinatorics problems. Suppose we want to find all non-negative integer solutions to 3a − 2b + c = 0. Then, the generating function will be an Elliot-rational function, a rational function which can be written as products in the denominator of the type A − B, where A and B are monomials in the variables. Then it is characterized by Next, we introduce a new variable λ and use an operator Ω = to force the constant term of the series, such that It can be shown that both the function before applying the operator and the one after are Elliot-rational functions [20]. In the 3a − 2b + c = 0 example it is written in closed form as .
Alternatively, an operator Ω ≥ can be shown to solve problems with inequalities.
In general one defines the operator Ω = as in [20] where the variables λ i are restricted to the neighbourhood of |λ i | = 1. The computation of such operation has been extensively covered by [29] which culminated with the development of the Omega package for Mathematica and later, by Guoce Xin, for Maple [30,31]. Besides the difference in platform, Guoce Xin's software uses a faster algorithm based on a different approach detailed in his paper. The fast algorithm in [30] is a very powerful tool for computing Hilbert series with the Weyl formula. It contrasts with the residue theorem as a faster and less resource hungry method and it is based on the following. Let G be a semi-simple group with a maximal torus T with an action on V given by diag[m 1 (z), . . . , m n (z)] where m(z) are Laurent monomials [22] in z 1 , . . . , z m . Then the character is given by with n = dim V . Let us define with eq. (3.15) and eq. (3.16) the Hilbert series It then follows [22] that the Hilbert series Thus, using Omega calculus, one can use eq. (4.5) to write the important equality where instead of λ i we have z i . We note that the assumption that |z i | = 1 is a straightforward assumption in the Weyl formula. It is noteworthy that this algorithm will always work in a function of the type F (z 1 , . . . , z m ) ∈ K[z 1 , . . . , z m , z −1 1 , . . . , z −1 m ], i.e. it is described by powers of its variables and reciprocals alone, which is a common property in many physical applications.
The speed of Xin's algorithm is owed to partial fraction decomposition and with it we are able to remove entire rational functions which do not contribute to the final answer. This idea is first attributed to Richard P. Stanley in [32].

Pratical computation in Maple
The use of Xin's algorithm is fairly straightforward. It was used in [33] with Ell.mpl shortly after its introduction and in [34] where a version of eq. (4.9) is introduced and the package Ell2.mpl is used. The package is rather straightforward with the main function of our interest to be the command E OeqW(f, v, ve), where f is the integrand, v and ve are all the variables and the variables to integrate, respectively.
Example. We will compute the Hilbert series for the 2HDM in [16] starting with eq. (38). Thus, and (1 − z 2 ) = α + 1 − z α + . Then, using eq. (4.9) we have where z is the variable to eliminate and q, y and t are the remaining variables. In Maple we write: Example. The ungraded Hilbert series in eq. (3.12). While it is clear that we may just do q = y = t in our first example, we want to demonstrate the method when there are powers in the denominator. Hence, we start with and thus . (4.14) Then we use Maple and write: The output will be which after some algebra we can write as in agreement with eq. (3.12).

The 3HDM
The case of the full characterization and counting of invariants in the 3HDM is still an open problem. It is clear that the computation of their properties mirrors the one of the 2HDM, albeit the fact that it is much more complicated. We will present here for the first time the full computation of the Hilbert series of the 3HDM, in both expanded and closed form.

Definition of the Hilbert series
Following our previous results in decomposing V we may quickly arrive at the relevant decomposition of the 3HDM. The decomposition of z ij,kl is given by The decomposition of µ ij is straightforward and hence, a result that we compute differently in appendix A. 2 From here, we can already define the Hilbert series as in eq. (3.15) with the plethystic exponentials. Thus, the multigraded Hilbert series we are interested in is defined as where the token variables are s, t, u for the three adjoint representations and q for the 27. From eq. (3.17) we can compute the plethystic exponentials of the 8's and the 27. The plethystic exponential depends only on the character polynomials that we construct with the weight system of the irreducible representations. With LieART [35] it is straightforward to compute and which we already recognize as Elliot-rational functions. It may be inferred by examining eqs. (5.6) and (5.7) that the computation of this particular integral is difficult due to the existence of higher order poles, cubic and quartic polynomials as well as the plain fact that we are dealing with multivariate residues. These are known to be specially difficult to handle.
where we see a direct interpretation with eq. (3.6). It is important to note that these invariants are not necessarily algebraically independent, as this distinction will be computed only with the closed form of the Hilbert series.
The plethystic logarithm will be given by eq. (3.19) and it will allow us to know the type of invariants relevant for our study. The expansion is very long and we present the degree two and three invariants along with the first syzygy, i.e. the first negative term.

The Hilbert series of the 3HDM
The Hilbert series of the 3HDM would naively be computed with the use of the residue theorem. By doing so, one quickly finds the computation to be very complex as various problems come into play. First, by solving higher degree polynomials in the denominator and integrating the first time we arrive at a second integration plagued with square, cubic and quartic roots of the integration variable. Secondly, it is not trivial to deal with the complex roots nor to use substitution of variables in the integrand. Omega calculus, used here for the first time for NHDM physical applications, offers the solution for all of these shortcomings.
In the 3HDM we have and then by eq. (4.9) and eq. (5.2) we write the ungraded Hilbert series as The code in Maple is straightforward and described in subsection 4.2. It ran for 56 minutes using 5 Gb of memory in a personal laptop equipped with an Intel Core i7-8750H. The solution, while not immediately in the form most useful to us, consists on the rational function where we refrained from writing the full palindromic polynomial of degree 146 in the numerator. Before going forward we note several interesting properties of eq. (5.13). First, the Krull dimension is 43, or equivalently the number of physical parameters minus the three singlets. This comes directly from eq. (3.26) as (27 + 3 × 8) − 8 = 43. We will make this connection exact in the next section. Second, by expanding around t = 1 we get (5.14) in agreement with eq. achieving the expected result. From eq. (5.13) it is not trivial to find a minimal Hilbert series that satisfies all the required properties. Simple algebraic manipulations lead us to thousands of solutions. After an intensive search using the Numpy package in Python we get to a seemingly minimal solution. Thus, the Hilbert series describing the most general 3HDM is given by 3 where the palindromic polynomial P 166 (t) is too large to write here but we will leave it as an attachment to this paper. We already see that eq. (5.17) also agrees with eq. (3.22) and eq. (3.23) Furthermore, we note the large degree invariants in eq. (5.17) contrasting with the case of the 2HDM. The question remains if this Hilbert series is minimal. Although we are confident with the result, only a subsequent study on the invariants themselves can point to whether this is an optimal solution. This will be the topic of a future paper [36].

Properties of the NHDM
In this section we will work out a number of interesting properties of the NHDM, which we can learn from the tools used so far. Our first result concerns the counting of the physical parameters of the NDHM.

Theorem 4. Let the model be the most general NHDM. Then, the number of physical parameters is given by
where N are the number of doublets. 4 Proof. Let the group G = SU(N ) be the family transformations of the NHDM and let us define a physical parameter as a family invariant parameter. Then we may define the invariant ring K[V ] G as having Krull dimension N physical and field K = C. The dimension of the initial space dim V is then given by where r i are the representations of the decomposition of the matrices µ and z, and the last equality is given by the counting of total parameters [37,38]. Then, we use a theorem in [39], asserting that the Krull dimension of K[V ] G is given by where G v is the stabilizer of G. 5 Because we already know that dim G = N 2 − 1, we only need to compute the dimension of the stabilizer for our case. Specifically, whether is zero (G acts freely on V ) or not. In ref. [40] the authors establish that if the action is reducible, and it is in our case, then G acts freely if at least one irreducible action acts freely. In particular, for the irreducible representation of a simple group, which is the case of SU(N ), dim G v = 0 if and only if dim r i > dim G. Thus, we only have to show that in the NHDM, there is always an irreducible representation with dimension greater than N 2 − 1. This is trivial because the decomposition of the NHDM always implies the computation of r a ⊗ r a for r a being the adjoint representation. This will always result in at least a representation of higher dimension than dim G which will always be needed for the decomposition. Hence, in the NHDM Our proof sheds light on the conditions of eq. (3.26) and shows its validity for a number of cases. This result does not hold in general for cases where symmetries are enforced in the Lagrangian. It does however bound the number of physical parameters in any NHDM. We summarize Theorem 4 in table 1.
Another result that we provide is on the form of a conjecture for multi-Higgs doublet models.

Conjecture 1. Let the model be the NHDM with N > 3. Then the vector space of parameters V is decomposed as
The decomposition of µ ij and z ij,kl is given by It is noteworthy that we have proved this result explicitly for all representations N < 15, in agreement with our conjecture. Furthermore, is is straightforward to show that Conjecture 1 is always a combinatorical solution and also that it is unique. The conditions for the conjecture to hold are discussed in detail in appendix A where the decomposition of SU(N ) adjoint representations is assumed to exist as illustrated in eq. (A.14).
We summarize our results in table 2, where we used the LieART package as well as Omega package for Mathematica [29] to confirm results. The functions b N and d N are defined as Table 2. Representation decomposition of the NHDM where b N and d N are given in (6.8). and the last line is representative of Conjecture 1.

Parameter counting with symmetries
So far we have discussed both the decomposition of the matrices of the Lagrangian, and the invariants of the most general multi-Higgs scalar models. However, we have not presented any result towards the use of symmetries in the Lagrangian. In this section we show how to count all of the remaining parameters after imposing a symmetry.
Theorem 5. Let us consider a symmetry by the action of a group G. We choose a representation ρ(g) = r = r i for the fields. Then the number of parameters is given by the number of singlets in µ ij →r ⊗ r , z ij,kl → Sym 2 (r) ⊗ Sym 2 (r) ⊕ Alt 2 (r) ⊗ Alt 2 (r) . (7.1) Proof. By imposing a symmetry in the Lagrangian we are decomposing the vector space V = µ ⊕ z in irreducible representations of G. In contrast with the strategy for basis invariants, we know that only the degree one invariants can remain. These correspond to elements (1 − t) in the denominator of the Hilbert series. A remarkable property of these terms is that they can be factored out from the summation as they do not depend on the representation. 6 This can be understood by decomposing where r T is the representation of the full decomposition. Then, and thus, The remaining irreducible representations r j are not invariant by themselves and require higher degrees to form an invariant. Consequently, we need not compute the Hilbert series to know how many invariants of degree one exist. This quantity is given by n in eq. (7.2), the number of singlets.
Example. We consider the 2HDM with a Z 2 symmetry. We choose the representation r = 1 ⊕ 1 ′ corresponding to the transformation diag(1, −1). Then, with the product rule For z ij,kl we need first to know what corresponds to Sym and Alt. This can easily be achieved with the character table and with χ Sym 2 (g) = 1 2 χ(g) 2 + χ(g 2 ) , where χ(g) is the character of g. This system always has a solution. Here, by choosing g = a, with a 2 = e, we have The only possible solution is that Consequently, the matrix z ij,kl decomposes as Hence, we conclude that the 2HDM has 8 parameters left after imposing Z 2 , 2 from µ ij and 6 from z ij,kl . We note four important facts. First, these 8 parameters are not physical, but 7 will be. Indeed, λ 5 can be made real after rephasing. Second, this result is completely basis-invariant. We might have chosen an equivalent matrix other than diag(1, −1), but nevertheless, any equivalent two dimensional representation would still decompose as above. Third, we have not taken rephasings into account as this is a consequence of the action of a global U(1) for one field alone. This is only possible after Z 2 is imposed. Third, we may even do better than just count the number of parameters in z ij,kl . By knowing how many singlets come from the Alt part, in this case just one, we can use the decomposition in SU (2) to assign it to a particular group of parameters. Similarly, we can do the same for the Sym part.
Example. We consider the 2HDM with a Z 3 symmetry. We define ω = exp(2iπ/3) and choose r = 1 ′ ⊕ 1 ′′ corresponding to the action of diag(ω, ω 2 ). The product rules are given by Choosing the element g = a with a 3 = e, the identity element, we find χ Sym 2 (a) = 1 2 (1 + (−1)) = 0 , where we used that χ(a) = Tr diag(ω, ω 2 ) = −1 = χ(a 2 ). Then, the only possibility is Therefore, we decompose z ij,kl as Hence, we conclude that the 2HDM with Z 3 symmetry has 6 parameters, 2 from µ ij and 4 from z ij,kl . Here, the number of parameters coincides with the number of physical parameters.
Example. We consider the 2HDM with a U (1) symmetry. We use the transformation diag(e iξ , e −iξ ), which corresponds to r =1 ′ ⊕ 1 ′ . The product rules are given by (7.16) where contrarily to the other examples, we have another representation appearing in the product rules, a consequence of G infinite. With it, µ ij decomposes as The characters, if we choose a to be the element with representation diag(e iξ , e −iξ ), are given by Thus, the only solution is given by Therefore, we decompose z ij,kl as This result is remarkably similar to the case of Z 3 . This is not coincidental as in fact they lead to the same symmetry constraint in the 2HDM [37]. This can be seen from the fact that it only differs in the representations that are primed, those that we will not keep.
Example. We consider the 2HDM with a S 3 symmetry. We choose r = 2 corresponding to the action of doublet representation in the fields. The product rules are given by Then µ ij decomposes as Choosing g = (1, 2) and consulting the character table we get Then, the only possibility is Thus, z ij,kl decomposes as Consequently, this model has 4 parameters, 1 from µ ij and 3 from z ij,kl . This can be checked against [41].
Example. We consider the 3HDM with a A 4 symmetry. We choose r = 3 corresponding to the action of doublet representation in the fields. The product rules are given by Then µ ij decomposes as Choosing g = (1, 2)(3, 4) and consulting the character table we get where we used g 2 = e, the identity element. The only possibility is Thus, z ij,kl decomposes as With this we conclude that this model has 6 parameters, 1 from µ ij and 5 from z ij,kl . This can be checked against [42].
Example. Finally we consider the 3HDM with a S 4 symmetry. We will not write every tensor product rule in this case they are many. Choosing r = 3 we get Choosing g = (1, 2) we get the characters and then Thus, the 3HDM with S 4 symmetry has 5 parameters, 1 from µ ij and 4 from z ij,kl . This can be checked against [42].
There are many interesting analysis that one can make from these examples. It is easy to check that choosing the 2HDM with a symmetry diag(i, −i) yields a similar result to the one we obtained with Z 2 . However, choosing diag(1, i) yields a similar result to the one of Z 3 and U(1). Both are cases in which a group effectively acts as another.
One result we can infer from this and previous sections is that due to the decomposition of any NHDM into representations of SU(N ), we are always guaranteed to have three singlets. This result follows from the fact that any G that we choose will be a subgroup of PSU(N ). If SU(N ) guarantees three singlets, so will any symmetry groups. Furthermore, these three will be physical parameters.

Conclusions
We studied in detail the group structure of the matrices in the scalar potential of multi-Higgs doublet models. We show its decomposition under irreducible representations of SU(N ) with a simple formula using the symmetric and antisymmetric part of the tensor product. With this decomposition, the study of the physical parameters of the theory becomes attainable.
We have used a tool from partition theory, Omega calculus, to compute complicated Hilbert series without using the residue theorem. Its use in high-energy physics is a first, as most computations depend on the residue theorem. In particular, we compute for the first time the closed form of the Hilbert series of the 3HDM, a result previously very difficult to obtain by standard methods. From this function, we will be able to completely characterize the physical parameters of the 3HDM.
Using a number of formal results in invariant theory we proved that the most general NHDM has (N 4 + N 2 + 2)/2 physical parameters. We also showed a second algorithm to compute the decomposition of NHDM based on combinatorics. We presented a formula to decompose the matrices of the Lagrangian for N < 15. We leave the formula as a conjecture for all N .
For the first time we derived a basis-invariant method for counting parameters in a Lagrangian with both basis-invariant redundancies and global symmetries. We show that the knowledge of tensor product decomposition and character theory is enough for attaining this purpose. Furthermore, this technique does not require analysis of the Lagrangian itself.
With invariant theory, we hope that a clear path to a full basis-invariant overview to the physical parameters of NHDM will soon be possible. There are still many unanswered questions on the CP properties and the physical parameters in theories with symmetries, both of which we have not addressed in this paper. Acknowledgments M. P. B. is very grateful to J. P. Silva for all the useful discussions on scalar models and endless advice. M. P. B. is also grateful to A. Trautner for the time spent explaining invariant theory in scalar models. This work is supported in part by the Portuguese Fundação para a Ciência e Tecnologia (FCT) under contract SFRH/BD/146718/2019. This work is also supported in part by FCT under contracts CERN/FIS-PAR/0008/2019, PTDC/FIS-PAR/29436, UIDB/00777/2020, and UIDP/00777/2020.

A An algorithm for the decomposition of the NHDM
In section 2 we decomposed the matrices µ and z of the scalar potential such that its bare elements transform under a direct sum of irreducible representations of SU(N ). In order to do that we have followed Trautner [16] in the use of projection operators to enforce hermiticity and symmetrization in indices. In this appendix we will concern ourselves with the combinatorics of such decomposition. We show an alternative method and reason in favor of Conjecture 1.

A.1 The 2HDM
In the 2HDM the family group SU(2) acts on the matrices µ and z under the fundamental representations, i.e. the two doublets form a family space doublet. Then the decomposition is given by The projection operators then reduce the representations to and which was done in section 2.

A.2 The 3HDM
Given a multi-Higgs doublet model we may ask if it is possible to guess the representations needed to compute the Hilbert series. A simple solution would be to find how many of the initial irreducible representations sum to the number of parameters the model has. It turns out that we can follow a simple algorithm with partition analysis, the same tool we use to compute H(K[V ] G , t). In the 3HDM we know that the number of parameters is 54 (cf. table 1 of [37]). The product decomposition before the projection operators is given by3 Without the use of the projection operators we already know that the non-singlet representations must add to 51 and that the octet in eq. (A.6) must be included. Then, it is a combinatorical task to find the non-singlet representations of eq. (A.7) that sum to 51 − 8 = 43. Luckily, this can be easily computed with Omega calculus and thus for a total sum of 54 parameters. It is noteworthy that we haven't mentioned projection operators at all in the 3HDM and it agrees with previous computations.

A.3 The NHDM
For a general multi-Higgs doublet model we can easily generalize the procedure we used for the 3HDM. The algorithm goes as follows. Let the model be the NHDM with family transformation group SU(N ) with r i , r f , and r a a generic, a fundamental, and adjoint representation respectively. We may then decompose, where m i are the multiplicities. Then, the remaining representations of z ij,kl are given by where r i are the unique dimensions of the decomposition and dim V = N 2 (N 2 + 3)/2. After testing results for 3 < N < 15 it becomes clear that eq. (A.13) yields an unique and equal answer among them. With this in mind we are able to conjecture for cases N > 3. If the decomposition of the adjoint representation in SU(N ) is given by Then, it is straightforward to prove that 16) for N > 3.
Proof. If eq. (A.14) holds true then the expansion of eq. (A.13) will always have to cancel the λ terms to be a solution. Thus, all solutions are solutions of which is a simple linear equations problem where we must match the polynomial on the LHS with the one of the RHS. The solution is unique

B Hilbert series in SU(3)
For completeness and such that we may provide results for the reader in case there is need for Hilbert series in SU(3) we list the ungraded Hilbert series that we computed before going to the case of the 3HDM.

B.1 One 8
For the case of one 8, dim V = 8 and the Hilbert series is given by where the Krull dimension dim K[V ] G = 2.

B.2 Two 8's
For the case of two 8's, dim V = 16 and the Hilbert series is given by where the Krull dimension dim K[V ] G = 8.

B.4 One 27
For the case of one 27, dim V = 27 and the Hilbert series is given by where the numerator is too large to show in this form. It is given by a palindromic polynomial of degree 74 for which we list the first 37 coefficients