On algorithms to find -ordering
Abstract
The concept of -ordering for a prime was introduced by Manjul Bhargava (in his PhD thesis) to develop a generalized factorial function over an arbitrary subset of integers. This notion of -ordering provides a representation of polynomials modulo prime powers, and has been used to prove properties of roots sets modulo prime powers. We focus on the complexity of finding a -ordering given a prime , an exponent and a subset of integers modulo .
Our first algorithm gives a -ordering for set of size in time , where set is considered modulo . The subsets modulo can be represented succinctly using the notion of representative roots (Panayi, PhD Thesis, 1995; Dwivedi et.al, ISSAC, 2019); a natural question would be, can we find a -ordering more efficiently given this succinct representation. Our second algorithm achieves precisely that, we give a -ordering in time , where is the size of the succinct representation and is the required length of the -ordering. Another contribution that we make is to compute the structure of roots sets for prime powers , when is small. The number of root sets have been given in the previous work (Dearden and Metzger, Eur. J. Comb., 1997; Maulick, J. Comb. Theory, Ser. A, 2001), we explicitly describe all the root sets for , and .
Keywords:
root-sets computational complexity -ordering polynomials prime powers1 Introduction
Polynomials over finite fields have played a crucial role in computer science with impact on diverse areas like error correcting codes [BRC60, Hoc59, RS60, Sud97], cryptography [CR01, Odl85, Len91], computational number theory [AL86, AKS04] and computer algebra [Zas69, LLL82]. Mathematicians have studied almost all aspects of these polynomials; factorization of polynomials, roots of a polynomial and polynomials being irreducible or not are some of the natural questions in this area. There is lot of structure over finite field; we can deterministically count roots and find if a polynomials is irreducible in polynomial time [LN97]. Not just that, we also have efficient randomized algorithms for the problem of factorizing polynomials over finite fields [CZ81, Ber70].
The situation changes drastically if we look at rings instead of fields. Focusing our attention on the case of numbers modulo a prime power (ring , for a prime and a natural number ) instead of numbers modulo a prime (field ), we don’t even have unique factorization and the fact that the number of roots are bounded by the degree of the polynomial. Still, there has been some interesting work in last few decades. Maulik [Mau01] showed bound on number of roots sets, sets which are roots for a polynomial modulo a prime power. There has been some recent works giving a randomized algorithm for root finding [BLQ13] and a deterministic algorithm for root counting [DMS19, CGRW19].
The concept of -ordering and -sequences for a prime , introduced by Bhargava [Bha97], is an important tool in studying the properties of roots sets and polynomials over powers of prime [Mau01, Bha97, Bha09]. Bhargava’s main motivation to introduce -ordering was to generalize the concept of factorials ( for ) from the set of integers to any subset of integers. He was able to show that many number-theoretic properties of this factorial function (like the product of any consecutive non-negative integers is divisible by ) remain preserved even with the generalized definition for a subset of integers [Bha00].
For polynomials, -ordering allows us to give a convenient basis for representing polynomials on a subset of ring . One of the interesting problem for polynomials over rings, of the kind , is to find the allowed root sets (Definition 3). Maulik [Mau01] was able to use this representation of polynomials over (from -ordering) to give asymptotic estimates on the number of root sets modulo a prime power ; he also gave a recursive formula for root counting.
Our contributions
While a lot of work has been done on studying the properties of -orderings [Mau01, Joh09, Bha09], there’s effectively no work on finding the complexity of the problem: given a subset of numbers modulo a prime power, find a -ordering. Our main contribution is to look at the computational complexity of finding -ordering in different settings. We also classify and count the root-sets for , when , by looking at their symmetric structure.
-
•
-ordering for a general set: Suppose, we want to find the -ordering of a set , such that, . A naive approach, given in Bhargava [Bha97], gives a time algorithm. We exploit the recursive structure of -orderings and optimize the resulting algorithm using data structures. These optimizations allow us to give an algorithm that works in time. The details of the algorithm, its correctness and time complexity is given in Section 3.
-
•
-ordering for a subset in representative root representation: A polynomial of degree in can have exponentially many roots, but they can have at most representative roots [Pan95, DMS19, BLQ13] giving a succinct representation. The natural question is, can we have an efficient algorithm for finding a -ordering where the complexity scales according to the number of representative roots and not the size of the complete set. We answer this in affirmative, and provide an algorithm which works in time, where is the number of representative roots and is the length of -ordering. The details of this algorithm and its analysis are presented in Section 4.
-
•
Roots sets for small powers: A polynomial in , even with small degree, can have exponentially large number of roots. But not all subsets of are a root-set for some polynomial. The number of root-sets for the first few values of were calculated numerically by Dearden and Metzger [DM97]. Building on previous work, Maulik [Mau01] produced an upper bound on the number of root-sets for any and . He also gave a recursive formula for the exact number of root-sets using the symmetries in their structure. We look at the structure of these root sets and completely classify all possible root-sets for . In Section 5, we discuss and distinctly describe all the root sets in , and .
2 Preliminaries
Our primary goal is to find a -ordering of a given set , for a given prime and an integer . Since the input size is polynomial in ; an efficient algorithm should run in time polynomial in these parameters. For the sake of clarity, factors will be ignored from complexity calculations; this omission will be expressed by using notation instead of in time complexity. We also use for the set .
We begin by defining the valuation of an integer modulo a prime .
Definition 1.
Let be a prime and be an integer. The valuation of the integer modulo , denoted , is the integer such that but . We also define .
If then both, and , are defined to be .
Definition 2.
For any ring with the usual operations and , we have
Definition 3.
A given set is called a root set in a ring if there is a polynomial , whose roots in are exactly the elements of .
Representative Roots:
The notion of representative roots in the ring has been used to concisely represent roots of a polynomial [Pan95, DMS19, BLQ13].
Definition 4.
The representative root is a subset of ,
Extending, a set of representative roots correspond to . Conversely, we show that an can be uniquely represented by representative roots.
Definition 5.
Let , then the set of representative roots is said to be a minimal root set representation of if
-
1.
,
-
2.
,
-
3.
Theorem 2.1.
Given any set , the minimal root set representation of is unique.
Proof.
For the sake of contradiction, let and be two different minimal representations of a set . There exists an such that it belongs to both representations, and and . Then can be written as and can be written as .
By Observation B.1, implies or . Without loss of generality, let (equivalently ).
From and , for all . Using , we get
contradicting minimality of .
∎
-ordering and -sequence
Bhargava [Bha97] introduced the concept of -ordering for any subset of a Dedekind domain, we restrict to the rings of the form [Bha00].
Definition 6 ([Bha97]).
-ordering on a subset of is defined inductively.
-
1.
Choose any element as the first element of the sequence.
-
2.
Given an ordering up to , choose which minimizes .
The -th element of the associated -sequence for a -ordering is defined by
. In the -th step, let then the value is denoted as the -value of at that step. If the step is clear from context, we call the -value of that element at that step as its -value.
The -ordering on a subset of can be defined similarly. Bhargava surprisingly proved the following theorem.
Theorem 2.2 ([Bha97]).
For any two -orderings of a subset and a prime , the associated -sequences are same.
3 Algorithm to find p-ordering on a given set
The naive algorithm for finding the -ordering, from its definition, has time complexity (Appendix A). The main result of this section is the following theorem.
Theorem 3.1.
Given a set , a prime and an integer such that each element of is less than , we can find a -ordering on this set in time.
The proof of the theorem follows by constructing an algorithm to find the -ordering.
Outline of the algorithm
We use the recursive structure of -ordering given by Maulik [Mau01]. Crucially, to find the -value of an element at each step, we only need to look at elements congruent to (Observation B.3).
Suppose is the set of elements of congruent to . By the observation above, our algorithm constructs the -ordering of set by merging the -ordering of ’s. Given a -ordering up to some step, the next element for the -ordering of is computed by just comparing the first elements in -ordering of ’s (not present in the already computed -ordering). The -ordering of translated ’s is computed recursively (Observation B.4).
While merging the -orderings on each of the ’s, at each step we need to extract and remove the element with the minimum -value over all ’s and replace it with the next element from the -ordering on the same set . Naively, it would need to find the minimum over all number of elements taking time. Instead, we use min heap data structure, using only time for extraction and insertion of elements.
Each node of the min-heap() consists of the following values,
-
1.
: contains -value of the element when added to -ordering,
-
2.
: contains the index of the set element belongs to, and
-
3.
: contains the value of the element.
These values are used to preserve the properties of the data structures used. With above intuition in mind, we develop Algorithm 1 to find the -ordering on a subset of .
In Algorithm 1, we use a sorted list of non-empty ’s, and only iterate over in steps 3-5, 23-28. Hence, decreasing the time complexities of these loops. We can create/update the list in the loop at steps 21-22.
3.1 Proof of Theorem 3.1
To prove the correctness of Algorithm 1, we need two results: Merge() procedure works and valuation is computed correctly in the algorithm.
Theorem 3.2 (Correctness of Merge()).
In Algorithm 1, given be a subset of integers, let for , , then given a -ordering on each of the ’s, Merge() gives a valid -ordering on .
Proof outline.
We start with -orderings on each of the non-empty sets , and create a heap taking the first element of each of these -ordering. At each successive step, we pick the element in the heap with minimum -value to add to the -ordering, and insert the next element from the corresponding to the heap.
We know that the valuation of any element in the combined -ordering is going to be equal to their valuation in the -ordering over the set containing them (by Observation B.3). If we show that at each step the element chosen has the least valuation out of all the elements left Merge() works correctly. We prove this by getting a contradiction if any element other than the ones obtained from the min heap is selected by showing the p_value will be greater than what we get from Merge().
The details of the proof can be found in Appendix D.1. ∎
Theorem 3.3 (Correctness of valuations).
In Algorithm 1, let be a subset of integers, then Find_-Ordering() gives a valid -values for all elements of .
Proof outline.
The proof requires two parts: Merge() preserves valuation and changes in the valuation due to translation does not induce errors.
-
•
To prove that Merge() preserves valuation, we make use of the fact that the combined -ordering after merge has the individual -orderings as a sub-sequence. Hence, the valuation of each element in the combined -ordering is going to be equal to the valuation in the individual -ordering (by Observation B.3). Hence, Merge() preserves valuations.
-
•
We show that the change in valuations due to translation (Step 24) are corrected (Step 27). This is easy to show by just updating the valuation according to Observation B.5.
Hence, valuations are correct maintained throughout the algorithm.
The details of the proof can be found in Appendix D.2. ∎
Using the above two theorems, we prove the correctness of Algorithm 1.
Proof of Theorem 3.1.
For the base case, if is a singleton, then the -ordering over it is just a single element which is also what Find_-Ordering() gives. Let Find_-Ordering() works for , if we show it works for , then by induction, Find_-Ordering() works for sets of arbitrary sizes.
Let , then when we break the set into (Steps 20-22), either all element belong in a single or get distributed into multiple sets. We can argue that if all the elements fall into the same group, then when we keep calling recursion (Step 24), after some point set breaks into multiple ’s. Since, by Observation B.4, we know that the -ordering on reduced elements is preserved, we’ll get the correct -ordering on the original set. Hence, we only need to prove this for the later case.
Since all the element of the set follow , , hence , , this implies . Hence, Find_-Ordering() gives a -ordering on with the correct valuations associated with each element (Theorem 3.3).
From Observation B.4, we know that if be a -ordering on some set , then be a -ordering on . Since, Find_-Ordering() is a -ordering on , then is a -ordering on (Step 26).
Next, since we have valid -orderings on , Merge() returns a valid -ordering on (Theorem 3.2).
By induction, our algorithm returns a valid -ordering on any subset of integers.
4 Algorithm to find -ordering on a set of representative roots
The notion of representative roots (Definition 4) allows us to represent an exponentially large subset of succinctly. Further imposing a few simple conditions on this representation, namely the minimal representation (Definition 5), our subset is represented in a unique way (Theorem 2.1). A natural question arises, can we efficiently find a -ordering given a set in terms of representative roots?
In this section we show that the answer is affirmative by constructing an efficient algorithm in terms of the size of the succinct representation.
Theorem 4.1.
Given a set , for a prime and an integer , that can be represented in terms of representative roots, we can efficiently find a -ordering of length for in time.
The proof of the theorem follows by constructing an algorithm to find the -ordering given a set in representative root notation. We can assume that the representative roots are disjoint. If they are not, one representative root will be contained in another (Observation B.1), all such occurrences can be deleted in time.
Outline of the algorithm
The important observation is, we already have a natural -ordering defined on a representative root (Observation B.6). Since a -ordering on each representative root is already known, we just need to find a way to merge them. Merging was easy in Algorithm 1 because progress in any one of the -ordering of an did not effect the -value of an element outside . However, in this case the exact increase in the -value is known by Observation B.2.
Let be the number of representative roots, we maintain an array of size to keep the valuations that we would get whenever we add the next element from a representative root. To update the -th value of this array when an element from the -th representative root is added, we simply add the value (). Hence, at each step we find the minimum value in this array (in d) and add it to the combined -ordering (in 1) and we update all the values in this array (in d). We repeat this process till we get the -ordering of the desired length.
With the above intuition in mind, we develop Algorithm 2 to find the -ordering of length on a subset of given in representative root representation.
4.1 Proof of Correctness
To prove the correctness of our algorithm, we first prove that valuations are correctly maintained.
Theorem 4.2.
In Algorithm 2, Find_-Ordering() maintains the correct valuations on the set of representative roots in at every iteration of the loop.
Proof outline.
All elements have 0 valuation at the beginning (Step 17). Also, adding an element from the -th representative root increases the valuation of the -th representative root by (Step 33) for (Observation B.2). The increase for the next element of is exponent times the increase in -sequence of (Step 30) (Observation B.6). So, we correctly update the valuations array in each iteration.
A detailed proof can be found in Appendix E.1. ∎
Proof of Theorem 4.1.
By the definition of -ordering we know that at each iteration if we choose the element with the least valuation then we get a valid -ordering. By Theorem 4.2, we know that array has the correct next valuations. Hence, to find the representative root with gives the least valuation, we find the index of the minimum element in .
To add the next value to the -ordering, we use Observation B.6 to find the next element in the -ordering on the representative root. Hence, the element added has the least valuation. Hence, Find_-Ordering() returns the correct -ordering.
5 Structure of root sets for a given
We know that is not a unique factorization domain. In fact, even small degree polynomials can have exponentially large number of roots. Interestingly, not all subsets of can be a root set (Definition 3). Dearden and Metzger [DM97] showed that is a root-set iff is also a root-set for all . The size and structure of is symmetric for all . Let be the number of possible ’s, then total number of possible root-sets become [DM97]. In this section, we discuss and describe all possible ’s in , and .
Let , we take the following approach to find all possible root-sets ’s. Given an , define to be the translated copy. We show that if contains at least many distinct residue classes , then (Observation F.1). We exhaustively cover all the other cases, when contains less than residue classes (possible because is small).
5.1
We find that the root set can only take the following structures (details in Appendix F.1).
-
1.
root-set is the complete sub-tree under (more than 1 residue class), equivalently
-
2.
root-sets are a single element congruent to (1 residue class), equivalently
-
3.
root-set is empty (no residue classes), equivalently
Hence, total root-sets, .
5.2
Similar to , the root sets can only take the following structure (details in Appendix F.2).
-
1.
root-set is the complete sub-tree, equivalently
-
2.
root-sets are the union of 2 sub-trees different at the level , equivalently
-
3.
root-sets are a sub-tree at the level , equivalently
-
4.
root-sets are a single element congruent to , equivalently
-
5.
root-set is empty, equivalently
Hence, total root-sets, .
5.3
Similar to , the root sets can only take the following structure (details in Appendix F.3).
-
1.
root-set is the complete sub-tree under , equivalently
-
2.
root-sets under are the union of 3 sub-trees different at the level , equivalently
-
3.
root-sets are the union of 2 sub-trees different at the level , equivalently
-
4.
root-sets are a sub-tree at the level , equivalently
-
5.
root-sets are a union of 2 sub-trees at the level that are different at the level , equivalently
-
6.
root-sets are a sub-tree at the level , equivalently
-
7.
root-sets are a single element congruent to , equivalently
-
8.
root-set is empty, equivalently
Hence, total root-sets, .
References
- [AKS04] Manindra Agrawal, Neeraj Kayal, and Nitin Saxena. Primes is in p. Annals of mathematics, pages 781–793, 2004.
- [AL86] Leonard Adleman and Hendrik Lenstra. Finding irreducible polynomials over finite fields. In Proc. 18th Annual ACM Symp. on Theory of Computing (STOC), 350 - 355 (1986), pages 350–355, 11 1986.
- [Ber70] E.R. Berlekamp. Factoring polynomials over large finite fields. Mathematics of Computation, 24:713–735, 07 1970.
- [Bha97] Manjul Bhargava. P-orderings and polynomial functions on arbitrary subsets of dedekind rings. Journal Fur Die Reine Und Angewandte Mathematik - J REINE ANGEW MATH, 1997:101–128, 01 1997.
- [Bha00] Manjul Bhargava. The factorial function and generalizations. American Mathematical Monthly, 107, 11 2000.
- [Bha09] Manjul Bhargava. On -orderings, rings of integer values functions, and ultrametric analysis. Journal of the American Mathematical Society, 22(4):963–993, 2009.
- [BLQ13] Jérémy Berthomieu, Grégoire Lecerf, and Guillaume Quintin. Polynomial root finding over local rings and application to error correcting codes. Applicable Algebra in Engineering, Communication and Computing, 24(6):413–443, 2013.
- [BRC60] R.C. Bose and D.K. Ray-Chaudhuri. On a class of error correcting binary group codes *. Information and Control, 3:68–79, 03 1960.
- [CGRW19] Qi Cheng, Shuhong Gao, J Maurice Rojas, and Daqing Wan. Counting roots for polynomials modulo prime powers. The Open Book Series, 2(1):191–205, 2019.
- [CLRS01] T. H. Cormen, C. E. Leiserson, R. L. Rivest, and C. Stein. Introduction to Algorithms. MIT Press, Cambridge, MA, 2001.
- [CR01] Benny Chor and Ronald Rivest. A knapsack type public key cryptosystem based on arithmetic in finite fields. IEEE Transactions on Information Theory, 34, 09 2001.
- [CZ81] David Cantor and Hans Zassenhaus. A new algorithm for factoring polynomials over finite fields. Mathematics of Computation, 36, 04 1981.
- [DM97] Bruce Dearden and Jerry Metzger. Roots of polynomials modulo prime powers. Eur. J. Comb., 18:601–606, 08 1997.
- [DMS19] Ashish Dwivedi, Rajat Mittal, and Nitin Saxena. Efficiently factoring polynomials modulo . International Symposium on Symbolic and Algebraic Computation, pages 139–146, 07 2019.
- [Hoc59] A. Hocquenghem. Codes correcteurs d’erreurs. Chiffres, Revue de l’Association Française de Calcul, 2, 01 1959.
- [Joh09] Keith Johnson. P-orderings of finite subsets of dedekind domains. Journal of Algebraic Combinatorics, 30:233–253, 2009.
- [Len91] H. Lenstra. On the chor—rivest knapsack cryptosystem. Journal of Cryptology, 3:149–155, 01 1991.
- [LLL82] Arjen Lenstra, H. Lenstra, and László Lovász. Factoring polynomials with rational coefficients. Mathematische Annalen, 261, 12 1982.
- [LN97] Rudolf Lidl and Harald Niederreiter. Finite fields, volume 20. Cambridge university press, 1997.
- [Mau01] Davesh Maulik. Root sets of polynomials modulo prime powers. J. Comb. Theory, Ser. A, 93:125–140, 01 2001.
- [Odl85] A. Odlyzko. Discrete logarithms and their cryptographic significance. Advances in Cryptography, EUROCRYPT ’84, Proceedings, Lecture Notes in Computer Science, 209:224–314, 1985.
- [Pan95] Peter N Panayi. Computation of Leopoldt’s P-adic regulator. PhD thesis, University of East Anglia, 1995.
- [RS60] I. Reed and G. Solomon. Polynomial codes over certain finite fields. Journal of the Society for Industrial and Applied Mathematics, 8:300–304, 06 1960.
- [Sud97] Madhu Sudan. Decoding reed solomon codes beyond the error-correction bound. Journal of Complexity, 13:180–193, 03 1997.
- [Zas69] Hans Zassenhaus. On hensel factorization ii. Journal of Number Theory, 1:291–311, 07 1969.
Appendix A Naive Algorithm to find -ordering
Given a set of integers we can find a -ordering by naively checking the element which will give us the minimum valuation with respect to for the given expression as in Definition 6. After we have already chosen we choose the next element from such that is minimum. The naive approach given in [Bha97] iterates over all in and adds the element to the -ordering which gives the minimum valuation.
Time Complexity:
Every time we keep on adding another element to the already existing -ordering, say of length . For any given value of , calculating and multiplying for every takes operations in and since each of them are less than this takes . So repeating this times gives us the time complexity .
Appendix B Observations about representative roots and -sequences/-orderings
B.1 Representative roots
Observation B.1.
Given any two representative roots and , then either or or .
Proof.
Let and be two root sets such that , then we show that or .
Case 1:
Let . Let there is some element . Then and , hence, can be defined as and similarly . Hence, .
Case 2:
Let , then without loss of generality, let’s assume that . Let there is some element . Then, can be defined as and similarly .
Let , then for some . Now, we know that the elements of are of the form . Hence, putting , we get , hence . Hence, . Hence, . ∎
Observation B.2.
Let and be any 2 elements of the representative roots and respectively, for , then,
Proof.
We have representative roots of the form and . WLOG let us assume that and .
We definitely have that these two are different representative roots. So if the first elements of the -adic expansion of are equal then the second representative root will be contained in the first, as the portion of the first contains all the values of the second representative root as well as its subset. So for them to be different representative roots, .
Let , , then for any value in the respective sets, we will have . Note that since we have .
Now, since and we can write for where . This implies that if , it means which can not be true as . So for any value of in the respective sets of their corresponding representative roots, we will have .
Conversely if such that , let . Then we have . So if (as ). This is a contradiction as .
This completes the proof of Observation B.2. ∎
B.2 -ordering and -sequence
Observation B.3 ([Mau01]).
Let be a subset of integers, let for , then for any , s.t. ,
(1) |
Observation B.4.
Let be a subset of integers, let () be a -ordering on , then
-
1.
For any , () is a -ordering on .
-
2.
For any , () is a -ordering on .
Observation B.5.
Let be a subset of integers, let be a -ordering on . Then, for any
-
1.
.
-
2.
.
Observation B.6.
Let be a -ordering on , then is a -ordering on .
Proof.
A simple proof of this theorem follows from Observation B.4 and the fact that form an obvious -ordering in . ∎
Appendix C Min-heap data structure
A min-heap is a data structure in which each node has at most two children and exactly one parent node (except root, no parents). The defining property is that the key value of any node is equal or lesser than the key value of its children.
We will use three standard functions on a min-heap with nodes [CLRS01].
-
1.
Create_Min_Heap(): Takes a set as input and returns a min-heap with elements of as the nodes in .
-
2.
Extract_Min(): Removes the element with the minimum key from the heap and rebalances the heap structure in .
-
3.
Insert(): Inserts the element into the heap in .
Appendix D Correctness and Complexity of Algorithm 1
D.1 Proof of Theorem 3.2
Let be a -ordering on each of the ’s. We know that Merge() on proceeds in such a way that elements are added to the heap in such a way that the element is added to the heap only after have already been added to the -ordering. Also, we know at any point, only one element from any can belong to the heap.
We know that at any point, let be a -ordering on , then the next element in the -ordering on if and only if
We know that if at each point, our pick for the next element in the -ordering satisfies this condition, the -ordering we get is valid.
Lets say be the -ordering we have till now. Let elements currently the elements of the given -ordering on set are currently a part of the -ordering. Let the elements are a part of the min-heap.
Let when we extract the min from the min-heap, we get some value . If we show that
then we know that is a valid next element in the -ordering and hence Merge() gives a correct -ordering on .
We prove this by contradiction. Let there is an element such that
Then, we have 2 cases, either , i.e. or for some , i.e. .
- Case 1:
-
.
Our assumption is that
We know that from our assumption that . From Observation B.3,
and
Since, is a valid -ordering on ,
But this is a contradiction.
- Case 2: for some
-
.
Our assumption is that
Let the element belonging to the set in the heap is . We know that from our assumption that . From Observation B.3,
and
Since, is a valid -ordering on ,
Also, since both and were part of the heap but procedure returned ,
Using the above two inequalities,
But this is a contradiction.
Since, we arrive at a contradiction in both the cases, hence, our assumption must be wrong. Hence,
Hence, our procedure Merge() gives a valid -ordering.
D.2 Proof of Theorem 3.3
We prove this by induction on the size of .
If is a singleton, then the -ordering on is just that element. And hence the corresponding -value is just . Find_-Ordering() sets this value to in step 18. Hence, our assumption is true for .
Let our assumption is true for , if we can show it for , then by induction, we know our assumption is true for sets of all sizes.
Let , then when we break this set into smaller (Steps 21-22), either all element belong in a single or get distributed into multiple sets. We handle the two case separately.
Case 1:
Let breaks into smaller .
In this case, we know all the have size less that . Hence, the sizes of is also less than for all . Hence, we get the correct -values for all elements when we call in step 24.
From Theorem B.5, we know that , hence we add to the -values of all elements of the output(step 27). We know that , hence, the -values of each element are correct at the end of step 27.
Next, we show that Merge() preserves the -values, we’re done, since we know that Merge() doesn’t update the -values of any of the elements. Let an element is added at the position in the -ordering output by Merge(). Let all the elements before this element are in the set . Then, we know that the -value of this element is . By Observation B.3, we know that this is equal to . Since, merge doesn’t re-order the -orderings on any input while merging, we know that this is exactly the -value of from before. Hence, Merge() preserves the -values.
Hence, the -values at the end of Merge() are correct (step 28). Hence, Find_-Ordering() gives the correct -values.
Case 2:
Let all elements of go into a single .
Since, we recursively keep calling Find_-Ordering() on the reduced set, we know at some point, we would reach case 1. As proven above, at this point, we would get the correct -values. Hence, if we can show that given a correct -values in step 24, Find_-Ordering() outputs the correct -values, then by a recursive argument, this would output the correct -values for any set of size .
Let’s say that all the elements of fall into some set . We assume that Find_-Ordering() outputs the correct -values, then if we can prove that we get the correct -values from , then by the above argument, we are done.
From Theorem B.5, we know that , hence we add to the -values of all elements of the output (step 27). We know that , hence, the -values of each element are correct at the end of step 27.
Since, all the elements in are in just one , Merge() acts as identity. Hence, the output at the end of Step 28 has the correct -values. Hence, Find_-Ordering() gives the correct -values for sets of size .
Hence, by induction, Find_-Ordering() outputs the correct -values on any subset of integers.
D.3 Time complexity of Algorithm 1
Theorem D.1.
Given a set of size and a prime , such that for all elements , for some , Algorithm 1 returns a -ordering on in time.
Proof.
We break the complexity analysis into parts, the time complexity for merging the subsets ’s and the time complexity due the to recursive step.
Time complexity of Merge() in Algorithm 1
Let . Then, the time complexity of making the heap (Step 7) is (the size of the heap). Next, the construction of common -ordering (Steps 8-14) takes time, this is because extraction of an element and addition of an element are both bound by and the runs a total of times. Hence, the total time complexity of Merge() is time.
Time complexity of Algorithm 1
Let and . Then the recursion depth of Find_-Ordering() is bound by . Now at each depth, all the elements are distributed into multiple heaps(of sizes ). Hence, the sum of sizes of all smaller sets at a given depth . Hence, the time to run any depth is . Hence, total time complexity for depth is . ∎
Appendix E Correctness and Complexity of Algorithm 2
E.1 Proof of Theorem 4.2
In this appendix we prove that the array from Algorithm 2 maintains the correct valuations.
First we initialize the valuations array to zero, which implies that when we have our -ordering as a null set and add the first element to it, we can select any number according to definition 6.
Suppose we have generated a -ordering upto length with being the number of elements from each representative root in . Now if we add another element to this -ordering, from say the representative root, the -value contributed corresponding to each of the representative roots apart from the one will be where , according to Observation B.2. Also since we have many elements from each of representative root, the contribution to -value will be . Next, we find the -value contributed due to the same representative root.
Notice that, from Observation B.6 we will have the elements of the representative root as a -ordering as well on , of length . Now by Theorem B.4, we will have this -ordering on as . When we add another element to this the -value contributed due to representative root will be .
Summing them the total -value at each step, considering the next element to be added being from representative root is . We choose such that this expression is minimum in our algorithm.
Now, we want to show that . We do this inductively. First we already have stored in each entry of . Let, we have obtained a -ordering upto length with the respective indices as with the -value corresponding to addition of next element from representative root correctly stored in . Next, when we add an element from say the representative root () we need to change the accordingly.
When we add this element we increase by one . Now when we add another element, say , (after the last element from the representative root), if then the new -value will be which is more than the previous . So accordingly we add this value in the previous step (when we find as the and then update in Steps 29-30).
However if this (the next after adding an element from representative root) is same as , then the -value will be while the previous value of was and this difference is stored in -Exponent_Increase(). We thereby update Steps 31-32 of Algorithm 2 to incorporate this change. Hence correctly stores the -value as desired.
E.2 Time complexity of Algorithm 2
Theorem E.1.
Given a set , for a prime and an integer , that can be represented in terms of representative roots, Algorithm 2 finds a -ordering of length for in time.
Proof.
Let contains representative roots of and we want to find the -ordering up to length , then, Correlate() runs a double loop, each of size , and each iteration takes , hence, Correlate() takes . -Exponent_Increase() runs a single loop of size where each iteration takes time, hence, it takes . Then main loop run a loop of size , inside this loop we do operations on elements of size , hence, it takes time. Hence, in total, our algorithm takes time. ∎
Appendix F Structure of root sets
Observation F.1.
Let , for ( is small), be a polynomial with root-set . Let for all , be numbers such that for no , . Let , for all , then .
Proof.
Let, for all , , then since is in the root set of , therefore,
Hence,
where, . Writing this system of equations in the form of matrices , we get,
Here, . Since , therefore, . Hence, has an inverse. Multiplying by the inverse on both sides, we get,
for , . Hence, for any element , (since ). Therefore, all elements of are a root of , or . ∎
F.1 Structure of root sets in
From Section 5.1, we know if be a root of some in . Then
Fixing to some , we start looking at structures.
F.1.1 Case 1: root set contains atleast two roots
Let, our root set contains two distinct roots, say and . Then,
and
Solving the above 2 equations, we get
and
Hence, any , for , is a root of the polynomial, or
Since, there’s no free variable in , we just have root-set of this structure.
F.1.2 Case 2: root set contains one root
Let, our root set contains just one root, say . Then,
One can easily see that no new roots seep in at this point and a root set of this form is possible111Namely .. Hence, for .
Since, , we just have root-sets of this structure.
F.1.3 Case 3: root set is empty
Let our root set is empty.222Namely , where . Hence,
Since, there’s no free variable in , we just have root-set of this structure.
Therefore, . Hence,
F.2 Structure of root sets in
From Section 5.2, we know if be a root of some in . Then,
Fixing to some , we start looking at structures.
F.2.1 Case 1: root set contains atleast three roots different at
Let, our root set contains three roots, say , and for . Then, substituting the value and solving the 3 equations, we get
and
Hence, any , for , is a root of the polynomial, or
Since, there’s no free variable in , we just have root-set of this structure.
F.2.2 Case 2: root set contains two roots different at
Let, our root set contains three roots, say and for . Then, substituting the value and solving the 2 equations, we get
and
Hence, any , for , and , for , is a root of the polynomial, or for and
Since, and , we just have root-sets of this structure.
F.2.3 Case 3: root set contains two roots same at
Let, our root set contains three roots, say and for . Then, substituting the value and solving the 2 equations, we get
and
Hence, any , for , is a root of the polynomial, or for
Since, , we just have root-sets of this structure.
F.2.4 Case 4: root set contains one root
Similar to Appendix F.1, we can have just one root as a root of and no new roots seep in. Hence, for .
Since, , we just have root-set of this structure.
F.2.5 Case 5: root set is empty
Similar to Appendix F.1, our root set can be empty. Hence,
Since, there’s no free variable in , we just have root-set of this structure.
Therefore, . Hence,
F.3 Structure of root sets in
From Section 5.3, we know if be a root of some in . Then,
Fixing to some , we start looking at structures.
F.3.1 Case 1: root set contains atleast four roots different at
Let, our root set contains four roots different at . Then, substituting the value and solving the 4 equations, we get
and
Hence,
Since, there’s no free variable in , we just have root-set of this structure.
F.3.2 Case 2: root set contains three roots different at
Let, our root set contains three roots different at . Then, substituting the value and solving the 3 equations, we get
and
Hence,
Since, , we have such root sets.
F.3.3 Case 3: root set contains three roots of which 2 are different at and 2 are different at
Similar to last case, we get
and
Hence,
Since, , we have such root sets.
F.3.4 Case 4: root set contains two roots different at
Similar to last case, we get
and
Hence,
Since, , we have such root sets.
F.3.5 Case 5: root set contains two roots different at
Let, our root set contains two roots different at . Then, substituting the value and solving the 2 equations, we get
and
Hence,
Since, and , we have such root sets.
F.3.6 Case 6: root set contains two roots different at
Let, our root set contains two roots different at . Then, substituting the value and solving the 2 equations, we get
and
Hence,
Since, , we have such root sets.
F.3.7 Case 7: root set is a single element
F.3.8 Case 8: root set is a empty
We have 1 such root set.
Therefore, . Hence,