Coloring so that no Pythagorean Triple is Monochromatic
CColoring so that no Pythagorean Triple isMonochromatic
Joshua Cooper and Ralph Overstreet
University of South Carolina, Department of Mathematics,1523 Greene Street, Columbia, SC 29208 [email protected] , Abstract.
We address the question of the “partition regularity” of thePythagorean equation a + b = c ; in particular, can the natural numbersbe assigned a 2-coloring, so that no Pythagorean triple (i.e., a solutionto the equation) is monochromatic? We prove that the hypergraph ofPythagorean triples can contain no Steiner triple systems, a natural ob-struction to 2-colorability. Then, after transforming the question into oneabout 3-CNF satisfiability and applying some reductions, a SAT solveris used to find a 2-coloring for { , . . . , } . Work continues as we seekto improve the reductions and extend the computation. Keywords:
CNF, Linear 3-Uniform Hypergraph, Partial Triple System,Partition Regular, Pythagorean Triple, Ramsey Theory, SAT, SteinerTriple System
One of the central problems in Ramsey Theory on the integers (see, for example,[1]) is the following question: given an equation – or set of equations – and apositive integer k , does there exist a coloring of N so that there are no monochro-matic solutions to the equation(s)? That is, suppose the family F of subsets of N is defined to be the set of solutions { x , . . . , x n } to a system of equations in n variables. Does there exist a function c : N → [ k ] so that, for each F ∈ F , thereare x i , x j ∈ F with c ( x i ) (cid:54) = c ( x j )? A system of equations is called “partitionregular” if, for any number of colors k , every k -coloring of the integers admits amonochromatic solution. Perhaps the most famous examples of partition regu-larity are the equations x + y = z (Schur’s Theorem) and x + y = 2 z (van derWaerden’s Theorem); Rado’s Theorem provides a vast generalization of theseexamples.A question that is surprisingly resistant to extant methods is the partitionregularity of the “Pythagorean equation” x + y = z ; see, e.g., [2]. To date, itis not even known if it is possible to 2-color the naturals so that there are nomonochromatic Pythagorean triples. However, there is a natural translation of a r X i v : . [ m a t h . C O ] M a y Joshua Cooper and Ralph Overstreet this question into that of solving a certain 3-CNF satisfiability problem: (cid:94) i,j,ki + j = k ( x i ∨ x j ∨ x k ) ∧ ( ¬ x i ∨ ¬ x j ∨ ¬ x k ) . (1)In this case, “true” and “false” assignments are the colors given to the indicesof variables.In order to show that the Pythagorean triples are partition regular, it sufficesto demonstrate a subfamily of them which is not bipartite, i.e., any 2-coloringinduces a monochromatic triple. (The existence of such a family follows from thede Bruijn-Erd˝os Theorem, q.v. [3].) It is known that no two Pythagorean triplesshare two points, i.e., no leg and hypotenuse of one right triangle are the twolegs of another integer right triangle. Indeed, the two equations x + y = z and y + z = t yield two squares ( y and z ) whose sum and difference are alsosquares. One can find an elementary proof that no such pair of squares exists inSierpi´nski’s classic text [4].Therefore, in our search for nonbipartite subsystems of triples, we need onlyconsider those in which each pair of triples intersect in at most one point. Suchfamilies are known as “linear 3-uniform hypergraphs” (in the graph theory com-munity) and “partial triple systems” or “packings” (in design theory). The small-est nonbipartite partial triple system is the ubiquitous Fano plane F , the projec-tive plane over F with seven points and seven triples. F is also a “Steiner triplesystem,” meaning that each pair of points is contained in exactly one triple. Infact, it is no hard to see that every Steiner triple system is not bipartite, so itis reasonable to search for these classic obstructions to 2-colorability among thePythagorean triples. However, we show below that a broad class of triple systemsincluding the family pyth of all Pythagorean triples contains no Steiner triplesystems. Therefore, any search for nonbipartite partial triple systems in pyth necessarily must consider other systems than Steiner triple systems.In the next section, we introduce some notation and definitions. Section 3contains the proof that pyth , and all ordered triple systems with the “sumproperty”, contain no Steiner triple systems. In the following sections, we de-scribe the satisfiability solving methodology used to show that at least [7664] is2-colorable without any monochromatic Pythagorean triples. We conclude withsome directions for further research. A triple system H is a pair ( V, E ) = ( V ( H ) , E ( H )) consisting of a vertex set V and a family of unordered triples E ⊂ (cid:0) V (cid:1) . A partial triple system , aka a , is a triple system in which each pair of distinct edgesintersect in at most one vertex. A Steiner triple system is a partial triple system S so that, for each pair of vertices x and y , there is some z so that { x, y, z } is anedge of S . An ordered triple system H is a triple ( V, E, < ) = ( V ( H ) , E ( H ) , < H )consisting of a vertex set V , a family of unordered triples E ⊂ (cid:0) V (cid:1) , and a total oloring Pythagorean Triples 3 ordering < on V . We say that an ordered triple system H has the sum property if, whenever { a, b, c } and { a (cid:48) , b (cid:48) , c (cid:48) } are two edges with respective maxima c and c (cid:48) , ( a ≤ a (cid:48) ) ∧ ( b < b (cid:48) ) ⇒ ( c < c (cid:48) ) . (2) Examples :1. Let V = Z , and, for each a (cid:54) = b , let e = ( a, b, a + b ) be an edge of E . Wecall this the Schur Triple System , and denote it by schur . It is easy to seethat schur has the sum property. This shows immediately that the sumproperty does not imply finite colorability, since Schur’s Theorem says thatany coloring χ : N → [ c ] with finitely many colors c admits a monochromatic e ∈ schur , i.e., | χ ( e ) | = 1. Such a map is called a (weak) hypergraph color-ing. A map χ : N → [ c ] so that | χ ( e ) | = 3 instead of just | χ ( e ) | > e ∈ E ( H ). Some areas of mathematics call this the “shadow”graph or “1-skeleton” of H , and denote it by the boundary operator ∂ H .2. It is clear that any order-preserving isomorphic image of a triple systemwith the sum property also has the sum property, and that any subhyper-graph of a triple system with the sum property does as well. For exam-ple, we define the Pythagorean Triple System pyth by V ( pyth ) = N and E ( pyth ) = {{ a, b, c } : a + b = c } . Since one can embed pyth into schur monotonically by the map n (cid:55)→ n , pyth has the sum property as well. It isa wide open problem to determine whether pyth has a weak coloring withfinitely many colors. (It is even open whether it is strongly colorable.) Asmentioned in the introduction, pyth is actually linear, i.e., no two edgesintersect in more than one vertex.3. A special subsystem of pyth is the Primitive Pythagorean Triple System prim consisting of all Pythagorean triples which are relatively prime. Thatis, V = N and E ( prim ) = {{ a, b, c } : a + b = c and gcd( a, b, c ) = 1 } . (3)It is easy to see that pyth is actually a union of dilates of prim by each d ∈ N .However, prim is bipartite: the parity coloring n (cid:55)→ n (mod 2) provides a2-coloring.We define a special class of partial triple systems called “bicycles.” The k -bicycle has 2 k + 2 vertices and 2 k edges. Its vertices are the elements of Z k andtwo “antipodes” a and b ; its edges are all triples of the form { a, j, j + 1 } and { b, j − , j } , 0 ≤ j < k . The 2-bicycle is also known as the Pasch configuration ,or quadrilateral : the six-point partial triple system consisting of the edges abc , ade , bef , cdf . The 3-bicycle appears in the literature as the “hexagon” (e.g., [5]):eight points { a, b, d, e, f, g, h, i } with edges { af h, aei, adg, beh, bdi, bf g } .The following proposition follows immediately from well-known results in thetheory of triple systems. (See, for example, [6].) For completeness, we give a shortproof. Joshua Cooper and Ralph Overstreet
Fig. 1.
A 3-bicycle and a 5-bicycle.
Lemma 1. If v, w are vertices of nontrivial Steiner triple system S , then thereis a k -bicycle for some k ≥ in S with antipodes v and w .Proof. Define the “link” S x of a vertex x ∈ S to be the set of pairs { a, b } so that { a, b, x } is an edge of S . For some z ∈ S , { v, w, z } is a triple of S , so S v consistsof a perfect matching M on S − { v, w, z } , plus the edge { w, z } ; similarly, S w consists of a perfect matching M on S − { v, w, z } , plus the edge { v, z } . Theunion of M and M is composed of even-length cycles of length at least 4; anyone of these forms a bicycle with antipodes v and w .We now define two weaker implicants of the sum property. We say thatan ordered triple system has the upper sum property if, whenever { a, b, c } and { a, b (cid:48) , c (cid:48) } are two edges with c and c (cid:48) their respective maxima,( b > b (cid:48) ) ⇒ ( c > c (cid:48) ) . (4)This clearly follows from the sum property by setting a = a (cid:48) . We say thatan ordered triple system has the lower sum property if, whenever { a, b, c } and { a (cid:48) , b (cid:48) , c } are two edges with c as both of their maxima,( a > a (cid:48) ) ⇒ ( b < b (cid:48) ) . (5)To see that the lower sum property follows from the sum property, suppose that a > a (cid:48) but b > b (cid:48) . Then it follows that the maximal element of { a, b, c } is greaterthan the maximal element of { a (cid:48) , b (cid:48) , c } , whence c > c , a contradiction. We saythat two pairs of integers { a, b } and { c, d } are “nesting” if a < c < d < b . Thenit is possible to restate the upper sum property as the fact that, for each vertex x , the subset of the link graph H x intersecting { y : y ≥ x } is a non-nestingmatching. The lower sum property may be similarly restated as the fact that, oloring Pythagorean Triples 5 for each vertex x , the subset of the link graph H x induced by { y : y ≤ x } is afully nested matching, i.e., for each two edges e and f , e is nested in f or viceversa. Proposition 1 If H has the upper sum property, and Q is a k -bicycle in H ,then the maximal two points of Q are not its antipodes.Proof. Let Q = ( Z k ∪ { a, b } , { a , a , a , . . . } ∪ { b , b , b , . . . } ) ⊂ H (6)be a k -bicycle, and suppose a and b are the maximal two points of Q . We mayassume without loss of generality that a > b . Then the maximal elements of alltriples are a or b (depending on which antipode they contain). Therefore, since { a, j, j + 1 } ∩ { b, j + 1 , j + 2 } = { j + 1 } ,( a > b ) ⇒ (2 j > j + 2) (7)for each 0 ≤ j < k . However, the quantities above are modulo 2 k , whence theset of resulting inequalities is circular and therefore inconsistent. Proposition 2 If H has the lower sum property, and Q is a k -bicycle in H ,then the maximal two points of Q are not its antipodes.Proof. Let Q = ( Z k ∪ { a, b } , { a , a , a , . . . } ∪ { b , b , b , . . . } ) ⊂ H (8)be a k -bicycle, and suppose a and b are the maximal two points of Q . Wemay assume without loss of generality that a > b . Then the maximal elementsof all triples are a and b (depending on which antipode they contain). Since { a, j, j + 1 } is an edge for each 0 ≤ j < k , the k pairs { j, j + 1 } are amatching, and they are linear ordered by nesting, by the lower sum property.Suppose, without loss of generality, that { , } is the outermost matching edgeand 0 <
1, so that, for all x ∈ Z k \ { , } , 0 < x <
1. The pairs {− , } and { , } are also nested, since they arise from the edges { b, − , } and { b, , } .Hence, − < { , } < < {− , } <
2, and each of these possibilitiescontradicts 0 < Corollary 3 If H has the full, lower, or upper sum property, then it does notcontain any Steiner triple system. In particular, pyth contains no Steiner triplesystem.Proof. Suppose H contained some Steiner triple system T . Let a and b be themaximal elements of T . Then a and b are the antipodes of some bicycle, byLemma 1. However, this contradicts Propositions 1 and/or 2.Note that a triple system with the sum property can contain a quadrilateral:for example, schur contains { , , } , { , , } , { , , } , { , , } . Joshua Cooper and Ralph Overstreet
We now describe the methodology used to certify the 2-colorability of the inducedhypergraph of pyth on the vertex set [7664].
To make a list of all Pythagorean triples having only elements less than or equalto some upper bound N, we use a function based on Dickson’s Method, fromWikipedia [7]. Our function for generating triples uses the equations r = 2 st for r, s , and t ∈ N , and x = r + s, y = r + t and z = r + s + t , with x + y = z .With these equations, we step through all combinations of s and t so that r ∈ N and z ≤ N. The Python code is short. import numpy as npdef dicksonGenTriples(uBound):data = []sSteps = range(1,uBound)for s in sSteps:tSteps = range(s,uBound-s)for t in tSteps:r = np.sqrt(2*s*t)if r == np.round(r):r = int(r)z = r + s + tif z >= uBound:breakx = r + sy = r + tif [x,y,z] not in data:data.append([x,y,z])with open(‘triples-dickson.json’,‘w’) as f:json.dump(data, f)return data
We remapped the integers involved in the Pythagorean triples to consecutiveintegers starting with 1 since, some SAT solvers require it. The bijection forremapping is represented in the Python code by a dictionary. {"3": 1, "4": 2, "5": 3, "6": 4, "8": 5, "10": 6}
The following is a CNF file for the triples with integers up to 10. These are [3,4,5]and [6,8,10]. oloring Pythagorean Triples 7 c 10p cnf 6 41 2 3 0-1 -2 -3 04 5 6 0-4 -5 -6 0
A full specification for CNF (Conjunctive Normal Form) is given at [8].
We experimented with glueSplit clasp, Dimetheus, SWDiA5BY, PeneLoPe, Lin-geling, and Treengeling, all from in2014. Treengeling is a parallel solver that runs on some or all of the cores ofa single machine, and seemed to be the fastest for a CNF corresponding to theset of triples up to about 7000. These runs completed within a few hours on eachof the many solvers. We did not emphasize finding the best solver.
A natural goal of SAT solving is to ease the burden on the solver by findingparts of the hypergraph, corresponding to the solver’s original CNF, which canbe safely removed without changing the satisfiability of the new, reduced CNF.We have had to rely on these reductions for upper bounds above 7620.Our only success to date at reducing the size of the input to the solver inthis way, is “pendant removal”. By pendant, we mean any edge (triple) of the3-uniform hypergraph which has at least one vertex not contained in any otheredges. Once a triple system with a pendant removed is properly 2-colored, thependant’s vertex, or vertices, of degree one can then be assigned any color thatis not assigned to some other vertex of its edge (of which there is always at leastone). Pendants are always removable and can be removed iteratively until nomore pendants remain. Once these pendants have been removed from a graphand the remaining graph has been fed to the solver and colored, it is easy to addback the removed pendant edges and 2-color them as they are added back. Theedges are added back in the reverse order that they were removed.
We use a strategy to parallelize across multiple nodes of a cluster similar to oneused in a paper by Biere, Heule, Kullmann, and Wieringa [9]. In particular, weconvert the problem into 2 m many potentially easier problems, by making 2 m copies of the original CNF file and appending a distinct list of extra clauses toeach one. We run these new CNF files on up to 2 m cluster nodes; one node perCNF. As soon as any node completes, if that CNF is satisfiable, we have our Joshua Cooper and Ralph Overstreet solution and can force all the other nodes to terminate before completing. Thevarious nodes do not communicate amongst themselves and run independentlyfrom one another.To create the extra clauses for each of the 2 m copies of the original CNFfile, we select m special vertices (integers), each coming from some Pythagoreantriple which was used to generate the original CNF. For each special vertex, i ,we make a new clause ( ¬ x i ∨ ¬ x i ∨ ¬ x i ) (9)or ( x i ∨ x i ∨ x i ) . (10)This gives us 2 m different lists of m extra clauses to add to each of the 2 m copies of the original CNF file. These extra m clauses provide the solver withpredetermined truth assignments for specific vertices. Either one of these 2 m runsof the SAT solver, on the slightly varying CNF files, will complete and providea valid coloring, or all the runs will complete and each certify unsatisfiability –given sufficient computational time. We present one of the 4 CNF files for the list of triples [[3,4,5],[6,8,10]], split on2 vertices; 3 and 4, which are remapped to 1 and 2. The line which begins withp is also updated by adding m = 2 to the last integer in the original CNF fileon that line. The original CNF had a 4 in that spot. Note especially the last 2clauses. c 10p cnf 6 61 2 3 0-1 -2 -3 04 5 6 0-4 -5 -6 01 1 1 0-2 -2 -2 0 It would be desirable to choose a list of m special vertices so that each vertexin the list is relatively independent from the others. By independence, we meanthat any assignment of truth values to the variables corresponding to specialvertices leads to a similar number of (partial) satisfying assignments. We haveattempted to gauge independence by measuring the time needed for each of the2 m truth value combinations to run using Treengeling. The minimum distancein the hypergraph of all Pythagorean triples, up to an upper bound, N , betweenany two of the special vertices is a reasonable proxy for their independence.Under current technical limitations, we have found m = 2 to run the fastest. oloring Pythagorean Triples 9 The BFS Method of Finding Distant Vertices
A promising method ofchoosing some v and v which are distant from one another in the hypergraphof Pythagorean triples is to use what we call the breadth-first search (BFS)method. By way of illustration, we present Figure 2 and Table 1. We start froma seed triple t , and use the method to find a t that is furthest from t . Once a Fig. 2.
A graph of some hypothetical list of triples where any 2 triples share an edgeif they intersect. For example t = [3,4,5] and t = [5,12,13] share an edge in a graphof this type, as the 2 triples share a vertex. Table 1.
The triples of each BFS level corresponding to the graph in Figure 2.level 0 1 2 3 4 5 6 7 t t t t t t t t t t t t triple appears in a level, it will not appear again in the list. When there is morethan one path from the seed to some other triple, the listing in Table 1 showsonly the shortest path. Thus any two triples which are in two distant levels fromone another, necessarily have a high minimum graph distance between them.In the Pythagorean Triple System, to find two vertices that are relatively farapart, we choose a seed triple with minimum constituent integers as small aspossible. In the example of Figure 3, we run the BFS method on a list of triplesthat has had its pendants removed. The plot gives an indication of the proximityof two vertices to each other and for the connectedness, loosely defined, of eachof the two vertices to the rest of the hypergraph. Fig. 3.
The bar plot shows the size of each BFS level for the list of pendant-removedtriples with all vertices less than or equal to 7664.
Gauging the Independence of a List of Special Vertices
As an illustrationof a methodology to gauge the independence of a set of vertices, we choose alist of 4 randomly selected special vertices and uniformly at random remove10% of the triples in the list of triples with vertices less than or equal to someupper bound around say, 7621. This speeds up the SAT solver computationsfrom about a day to about 100 seconds. Each run uses 1 node with 12 cores.Next we record the run time for 10 runs each, of the 16 truth value combinations,for the 4 special vertices. Each of the 10 runs of the SAT solver uses a differentreduced list of triples. There are a total of 10 reduced triple lists for the wholeprocess. See Figure 4. For each of the 16 truth value assignments, we computean empirical mean run time; then, the sample variance of these 16 numbers isthen computed. For a set of chosen special vertices, a low variance indicateshigh independence, since the solver worked approximately equally hard acrossthe different possible truth values.
We have devised a method for simultaneously running a fixed number of nodes,each running an instance of the solver on 12 cores. We are allowed to use up toabout 10 of these nodes at a time, after waiting in the queue for some amountof time. See a detailed description of our clusters at the University of SouthCarolina, Maxwell and Planck, at oloring Pythagorean Triples 11
Fig. 4.
Run times of 10 runs of each of the 16 possible truth values of the 4 specialvertices. The special vertices were chosen uniformly at random.
We use the two clusters interchangeably. Their specifications are as follows. – Maxwell • Hardware ∗
40 GL390 Nodes: 12 cores per node, Intel Xeon 2.4 GHz, 24 GBRAM ∗ ∗ ∗ • Interconnect ∗ QDR Infiniband • Software ∗ CentOS ∗ HP CMU cluster management utility ∗ OpenMPI ∗ Torque/Maui scheduler – Planck • Hardware ∗
20 SL250 Nodes: 12 cores per node, Intel Xeon 2.8 GHz, 24 GB RAM ∗
15 x 3 NVIDIA M1060 with 240 cores each, 3 x 3 ∗ NVIDIA M2070 with 448 cores each ∗
11 TB attached storage • Interconnect ∗ QDR Infiniband • Software ∗ CentOS ∗ HP CMU cluster management utility ∗ OpenMPI ∗ Torque/Maui schedulerOur parallelization starts from an outer shell script which runs a sequentialPython program that creates a fixed number of inner shell scripts, each running1 instance of Treengeling on one full node. The Python program, which is startedby the outer shell script, uses system calls to detect the completions of each ofthe inner shell scripts by detecting the existence of the output file for each innershell script. When an inner shell script completes, a new inner shell script is fedto the queue until all the desired instances of Treengeling have been submitted,or until one instance of Treengeling returns a valid coloring.
We present some evidence that splitting approximately 4 ways using 2 specialvertices is fastest, given current technical constraints. See Figure 5, which plotsrun time against the number of nodes at which the problem was split.
Fig. 5.
Some results of scalability testing.oloring Pythagorean Triples 13
Treengeling can find solutions for all the Pythagorean triples with integers upto 7620 in about 21 hours. If the list of triples has been pendant removed,Treengeling can find a solution for all triples up to 7650 in about 33 hours.
We have looked for some patterns in the large valid colorings found, but havenot found much. There seems to be a lot of freedom in how a coloring can beachieved, which seems to be a reason why we have not found any consistentpatterns in the colorings.
The coloring in Figure 6 was made by removing the pendants from the list oftriples with integers up to 7664, running the solver on the result, and addingback the triples, one at a time, in the reverse order that they were removed and2-coloring them as they were added back. The final coloring was checked to seethat every triple with all integers less than or equal to 7664 is bichromatic.Integers which do not occur in any triple, with all constituent integers of thetriple being less than or equal to 7664, are white. The solver colors every integerwhich it receives from any triple as either false or true. While some integersmight be colorable as either false or true in a particular coloring, the solver willassign some color to each of these integers along with every other integer that itreceives.
We are running a sequential Python function on the clusters that systematicallychecks all possible linear 3-uniform hypergraphs on n vertices to see if any fur-ther reductions to pyth can be made. We have not yet found any “removable”subgraphs that are not pendants, from the triple list up to 7700. We would liketo parallelize this sequential operation using Python and MPI, or C and MPI ifneed be. Acknowledgements
Thanks to Ron Graham, Bill Kay, and Christopher Poirelfor helpful discussions and ideas in the development of the present work. PaulSagona has been helpful with the high performance computing resources at theUniversity of South Carolina.
Fig. 6.
A coloring of the hypergraph of pyth induced by the vertex set [7664]. False is grey . True is black . Integers not appearing in the input to the solver are white . Theinteger positions climb vertically by columns from the lower left to the upper right.
References
1. Bruce M. Landman and Aaron Robertson: Ramsey theory on the integers. StudentMathematical Library, . American Mathematical Society, Providence, RI (2004)2. Joshua Cooper, Michael Filaseta, Joshua Harrington and Daniel White: Color-ings of Pythagorean triples within colorings of the positive integers. Journal ofCombinatorics and Number Theory , pp. 1–16. (2014)3. Oystein Ore: Theory of graphs. American Mathematical Society Colloquium Pub-lications, Vol. XXXVIII American Mathematical Society, Providence, R.I. (1983)4. Wac(cid:32)law Sierpi´nski: Elementary theory of numbers. North-Holland MathematicalLibrary, 31. North-Holland Publishing Co., Amsterdam; PWN—Polish ScientificPublishers, Warsaw (1988)5. Charles J. Colbourn and Yuichiro Fujiwara: Small stopping sets in Steiner triplesystems, Crypt. Commun. , no. 1, pp. 31–46 (2009)6. Charles J. Colbourn, Marlene J. Colbourn, Alexander Rosa: Completing smallpartial triple systems. Discrete Math. , no. 2-3, pp. 165–179 (1983)7. Wikipedia contributors: Formulas for generating Pythagorean triples, Wikipedia,The Free Encyclopedia, http://en.wikipedia.org/w/index.php?title=Formulas_for_generating_Pythagorean_triples&oldid=652792835 (accessed April 16, 2015).8. CNF, http://people.sc.fsu.edu/˜jburkardt/data/cnf/cnf.htmlhttp://people.sc.fsu.edu/˜jburkardt/data/cnf/cnf.html