Grobner Basis Representations of Sudoku A developer demonstrated three polynomial encodings of Shidoku (4x4 Sudoku) for a Grobner basis constraint solver, drawing on Arnold et al. (2009): the sum-product representation, the roots-of-unity representation, and the boolean Shidoku system. The sum-product form expresses the puzzle as 40 polynomial equations—10 for unknown cells, 6 for given cells, and 24 for the 12 units—and the approach was implemented in Python with SymPy, with code shared on Google Colab and GitHub. This is part of our series on Alternatives to Backprop for Reasoning Model s: - Part 1: Belief Propagation https://leetarxiv.substack.com/p/sinkhorn-solves-sudoku : Obscure Backprop Alternative That Solves Sudoku. - Part 2: Target Propagation https://leetarxiv.substack.com/p/target-propagation : Bengio’s Biologically Plausible Backprop Alternative. - Part 3: Forward Forward https://leetarxiv.substack.com/p/forward-forward-algorithm-hinton : Hinton’s New Alternative to Backpropagation. - Part 4 we are here : Grobner Constraint Solvers for Sudoku. 1.0 Introduction Grobner Basis Representations of Sudoku Arnold et al., 2009 1 footnote-1 demonstrates practical ways to encode Sudoku tables as polynomial constraints for a Grobner basis solver. https://leetarxiv.substack.com/p/resultants-grobner-basis-semaev If you know nothing about Grobner bases then we recommend this super friendly intro: We introduced Sudoku in Part 1 https://leetarxiv.substack.com/p/sinkhorn-solves-sudoku?utm source=publication-search when we coded the belief propagation https://leetarxiv.substack.com/p/sinkhorn-solves-sudoku?utm source=publication-search paper. Belief propagation https://leetarxiv.substack.com/p/sinkhorn-solves-sudoku?utm source=publication-search algorithm is a gradient-descent alternative that uses sinkhorn-knopp to solve sudoku with machine learning. This paper demonstrates 3 different ways to encode constraints for a polynomial Sudoku solver. Arnold et al., 2009 however works with Shidoku boards. 1.1 Shidoku Primer Shidoku is a Sudoku variant where regions each contain the integers 1-4 exactly once. Shidoku has 4 rows, 4 columns and 4 2 2 boxes, so 12 units. Typically one is provided 6 known cells and must fill 10 unknown cells. The rules are exactly similar to Sudoku and we went into extreme detail in part 1 https://leetarxiv.substack.com/p/sinkhorn-solves-sudoku?utm source=publication-search . The remainder of this article solves the left-most board in Figure 2 above. 2.0 Polynomial Representations of Shidoku Code is available on Google Colab https://colab.research.google.com/drive/12ZFuo REtD6TwI8-K2rcex8SM5 agjZB?usp=sharing and GitHub. Arnold et al., 2009 introduces three different polynomial representation of Shidoku: the sum-product representation, the roots-of-unity representation and the boolean shidoku system. Each representation has its advantages and we’ll cover each. If you know nothing about Grobner bases then we recommend this super friendly intro: 2.1 Sum-Product Representation The Sum-Product representation encodes the 4 possible cell values as a polynomial product: Furthermore, one encodes the fact that one must choose 4 numbers that sum to 10 and multiply to 24 exactly once as the polynomial pair: Note that the equation 2 pair above can be replaced by the single equation: The sum-product form encodes Shidoku rules as 40 polynomial equations. Then to encode provided cells one simply includes more equations. For instance, the left Figure 2 board needs these equations: Let’s break down the 40 equations among the cells and units we showed why there are 12 units in Section 1.1 : 1. 10 unknown cells. So 10 equations representing xi−1 xi−2 xi−3 xi−4 =0. 2. 6 known cells. So 6 equations where k is a provided constant in x-k = 0. 3. 12 units. So 24 eqs since each unit has x1+x2+x3+x4−10=0 and x1x2x3x4−24=0. 10+6+24= 40 equations. In Python, this resembles: python import sympy as sp board = 0,0,0,4 , 4,0,2,0 , 0,3,0,1 , 1,0,0,0 x = sp.Matrix 4,4,lambda i,j: sp.Symbol f"x{i+1}{j+1}" equations = for i in range 4 : for j in range 4 : v = x i,j equations.append v-1 v-2 v-3 v-4 if board i j == 0 else v-board i j units = x i,j for j in range 4 for i in range 4 units += x i,j for i in range 4 for j in range 4 units += x i,j for i in range bi,bi+2 for j in range bj,bj+2 for bi in range 0,4,2 for bj in range 0,4,2 for unit in units: equations += sum unit -10, sp.prod unit -24 G = sp.groebner equations, list x , order="lex" print "Variables:", len list x print "Equations:", len equations solutions = sp.solve equations, list x , dict=True print "\nSolutions:" for sol in solutions: for i in range 4 : print sol x i,j for j in range 4 Running this code yields our expected solution 2.2 Roots-of-Unity Representation The Roots-of-Unity representation encodes the 4 possible cell values as a complex polynomial product: For each cell pair, say w and x, one forces w and x to admit different values using the polynomial product: This form need 72 equations to encode Shidoku’s structure and the entries 1,2,3,4 are replaced by the fourth roots of unity { ±1,±i }. Let’s break down the 72 equations: 1. 10 unknown cells. So 10 equations representing x