5. Algorithm for Latin Square Isomorphic Polynomial
Two Latin squares are isomorphic if they can be transformed into each other through row permutation, column permutation, or sign permutation. To determine their isomorphism in polynomial time, four theorems are required. These theorems are derived from the definitions of Latin squares, group properties, outer group properties, and homogroup properties.
Theorem 1: If all the pairs of Latin squares in two Latin squares are the same in group or outer group, then the set of pairs of Latin squares must be the same.
Theorem 2: Pairings that are mutually external can be transformed to sub-axes by row-column swapping in polynomial time.
Theorem 3: Two Latin squares are identical under subline transformations in the main line canonical form if they can be mutually transformed through row and column permutations without symbolic substitution. This means these Latin squares can be identified as mutual pairs for subline operations within polynomial time, thereby making them completely identical.
Theorem 4: In a Latin square, if swapping positions of symbols a and b results in positions c and d also being swapped, then the swap of symbols a and b is equivalent to swapping symbols c and d. This means that after swapping symbols a and b, symbols c and d are also swapped. Therefore, the Latin square remains unchanged, as swapping symbols a and b again swaps both c and d. Note that multiple swaps may be equivalent because swapping positions of symbols a and b sometimes involves more than one pair of symbols. As long as positions are swapped, their symbol swaps are considered equivalent. Theorem 3 can be easily derived from Theorem 1 and Theorem 2, while Theorem 3 provides a simple proof and Theorem 4 offers a concrete interpretation.
Give a 9 by 9 Latin square and a 6 by 6 Latin square to illustrate
Any permutation of the (4:6) group on the initial region transforms the group into the light red area in the diagram. The outer group of any (4:6) group(5:3) The row-column permutation is transformed to the secondary main line in blue in the figure. At this time, the same group of group (4:6) and group (5:3) is shown in the cyan part of
Figure 8.
The paired group (3:1) is the outer group of the paired group (4:6) and the paired group (5:3). The paired group (3:1) and the paired group (4:6) are shown in the light orange section of
Figure 9. The paired group (3:1) and the paired group The same group (5:3) is shown in the brown part of
Figure 9, so as above, the outer group also corresponds to the corresponding position.
When paired groups on the secondary mainline are mutually external, their corresponding positions remain fixed. However, in odd-order Latin squares, there exists a portion that does not correspond to either the blue or light blue sections shown in
Figure 10. This specific area can be uniquely identified by any single paired group within it.
The following is a specific explanation of Theorem 4 using the 6×6 Latin square as an example
The Latin square in
Figure 13 is obtained by swapping the positions of group (1:2) in
Figure 12
It can be observed that after the positions of numbers 1 and 2 are swapped, the positions of numbers 4 and 5 also swap. In fact, not only do numbers 4 and 5 swap positions, but numbers 5 and 6 also swap positions, as shown in
Figure 14.
Now I’m going to use the 6 by 6 Latin square to show you how to do the Latin square isomorphic polynomial algorithm
1. First, compare the group structure of all numbers (symbols) as the main line. Look at the 4 A Latin grid and the 18A Latin grid.The group structure of numbers (symbols) as the main line in the 4A Latin grid is
18A Latin square numbers (symbols) as the main line group structure are respectively
It can be immediately observed that the group structure of 4A Latin Grid using all numbers as main lines differs entirely from that of 18A Latin Grid. This directly proves that 4A and 18A Latin Grids are not isomorphic, with a time complexity of , as the differing group structures cannot be resolved through numerical substitution. The group structure of 4A Latin Grid using all symbols as main lines remains identical. Such Latin Grids may possess unexpected algebraic properties due to their exquisite symmetry, which I will further investigate in subsequent studies.
2.The Latin grid structure with all symbols forms the same main line grouping structure such as the 9A Latin grid and the 11A Latin grid. The 9A Latin grid maintains identical main line grouping structures for all numbers.
11A The Latin grid has all the numbers as the main line and the group structure is also the same
Next, align the 9A Latin Grid with the 11A Latin Grid by matching their paired sets, then select identical outer groups for the secondary mainline. In the 11A Latin Grid: swap positions 4 and 3, then swap positions 3 and 1 (note that this is the swapped version of 3), followed by swapping positions 2 and 5. This alignment ensures the 9A and 11A Latin Grids share identical paired sets.
9A Latin square
11A Latin square
It has been observed that all pair groups in these two Latin squares exhibit symmetry about the secondary axis. Let me propose a hypothesis: If the primary axis group structure of all symbols in both Latin squares is identical, then their pair groups would also be symmetrical about the secondary axis. However, for configurations like 9A and 11 A Latin squares, such symmetry through the secondary axis would result in mirror images. While my digitally transformed version of 9A maintains the same primary axis group structure, its pair groups are not symmetric about the secondary axis. This phenomenon holds true for other Latin squares. The symmetry’s inherent beauty compels me to persistently seek proof, with potential complete documentation of this hypothesis in future versions. Subsequent testing will verify whether digital transformations alter the pair group structures.
The set of pairs is
For example, 4 and 1 are replaced to get
The structure of the group set remains unchanged as long as the main line configuration stays consistent. Therefore, the 9A and 11A Latin squares cannot undergo numerical substitution. As the number of rows increases, the proportion of these Latin squares grows significantly. My random sampling tests on 9×9 Latin squares consistently revealed this pattern, which is evident in their group set structures. Numerical substitution does alter the group structure, and according to Theorem 3, 9A and 11A Latin squares are not isomorphic. However, some configurations can be transformed through row-column permutations, provided no numerical substitution occurs. Theorem 3 remains applicable in such cases.
3.All symbols in the two Latin squares are grouped together with the same main line structure, and the group structure of the number replacement group is also unchanged. For example, 6A Latin square and 12A Latin square
Through numerical substitution analysis, we observed that swapping numbers between 4 and 1, 4 and 2, 4 and 3, 4 and 5, 1 and 2, 1 and 3, 1 and 5, 2 and 3, 2 and 5, and 3 and 5 does not alter the group composition. However, this substitution modifies the relationships between outer groups and within groups. When the symbolic relationships between outer and within groups are aligned, they become isomorphic if the secondary main lines match; otherwise, they are not.
For example,2 and 5 replace
At this point, the same group of pair groups (4:1) becomes a pair group (4:2), or you can compare all the outer groups and all the same groups of the pair groups by sorting them out. The relationship between the outer groups and the same groups of all the pair groups can be made the same through symbolic replacement in polynomial time, which is also an operation in polynomial time.
4.Both Latin squares share identical group structures for their main line operations. The group structure remains unchanged under number permutation, and neither external nor internal group relationships between them are altered. According to Theorem 3, we can determine whether two Latin squares are isomorphic within polynomial time by examining sub-line transformations that exclude number permutation operations. For instance, when comparing Latin square 19A and 22A, it’s crucial to avoid applying sub-line transformations during number permutation processes.
The secondary mainline does not contain the numbers 4 and 5 in the group. Therefore, these two numbers are swapped to check if they can be rearranged. If not, it indicates that these two Latin squares are not isomorphic. Note that in this step, only number combinations are excluded, meaning the total number of combinations is (n²-n)/ 2.
If the secondary line in the group contains numbers to be replaced, it may transition to the primary line. However, the secondary line pair in the Latin grid must consist of replacement numbers, meaning each secondary line should contain exactly one number to be replaced. The secondary lines must not contain two replacement numbers simultaneously. For example, 10A Latin grid.
At this stage, I have tested that even 6×6 Latin squares can be processed in polynomial time. However, since there’ s no guarantee that sub-rows will follow the aforementioned patterns, nor can we ensure that all two-number permutation tests will complete without being mapped to another, these two Latin squares remain isomorphic. As I haven’t provided proof of this, it might already be possible to solve Latin square isomorphism within polynomial time at this point. Nevertheless, I didn’t stop there and instead presented a polynomial-time algorithm for Latin square isomorphism that resolves all the aforementioned scenarios.
5.To solve the Latin Grid isomorphism problem in polynomial time, Theorem III serves as the cornerstone. While the secondary mainline structure of Latin Grid numbers undergoes transformation after digit replacement, its underlying modulo form remains unchanged. The key lies in identifying the corresponding secondary mainline modulo form within polynomial time. In the 19A Latin Grid framework, any digit replacement initially preserves its modulo form structure. This preservation mechanism is crucial for understanding the secondary mainline modulo form’s behavior.
Make a secondary main line for any group, then swap the numbers 6 and 5
As deduced from Theorem 3, the submainline modulo form remains invariant. In Figures 15 and 16, the steel-blue sections represent positions of group (6:6) and group (4:6) within their respective groups, as well as positions of group (5:5) and group (4:5) within their respective groups. Each steel-blue section position corresponds one-to-one with its corresponding permutation in both groups. Similarly, positions of group pairs on the submainline also maintain this one-to-one correspondence. Therefore, directly searching for the submainline modulo form enables solving Latin grid isomorphism problems within polynomial time. Below we detail the algorithmic steps using the 19A Latin grid as an illustration.
Figure 18 After digital replacement of the Latin grid, the submainline group selection in
Figure 17 is (4:6), (4:5), and (4:4). Generally, the submainline group containing more identical numbers is selected, but it can also be randomly selected without affecting the result. However, this selection is convenient for processing and more intuitive
Next, select any replaceable number (the previously mentioned number substitution does not alter the group set) for corresponding purposes. Of course, structural correspondence is also required. Group (1:2) cannot correspond to Group (5:6) because these two groups have different quantities. Here, I choose numbers 4 and 6 to correspond. Therefore, the red pair group (4:6) in
Figure 19 corresponds to the pair group (6:4), and the blue pair group (4:5) in
Figure 19 corresponds to the pair group (6:5)
It is evident that the secondary mainline patterns in
Figure 19 and
Figure 20 differ significantly. Specifically, the yellow number 5 in
Figure 20 should correspond to the steel-blue position, while the steel-blue number 4 should occupy the yellow position. Furthermore, the same group positions in Group (4:6) and Group (4:5) of
Figure 19 are paired as (2:1) (1:2), whereas in
Figure 20, the corresponding group positions of Group (6:4) and (6:5) are (2:1) (2:1). If the secondary mainline patterns were identical, the number 2 would correspond to the number 1. Therefore, we must switch the positions accordingly.
Figure 21 shows the correspondence between paired groups (6:4) and (6:5) in Latin squares, while
Figure 19 illustrates the same relationship for paired groups (4:6) and (4:5). This correspondence establishes that numbers 4 correspond to number 6, 1 to number 1, 2 to number 2, and 5 to number 5. By continuing this process with subsequent paired groups along the secondary mainline until all pairs are completed, we can align the modulo forms of the secondary mainlines in both Latin squares. This entire process can be completed within polynomial time, with a time complexity of
While this step is standard practice (as most would recognize), I’ll still outline the original algorithm since it boasts lower time complexity. The core mechanism remains unchanged: when processing symbols in two Latin squares, the primary alignment group structure stays consistent, while the numerical permutation groups remain stable. However, the relationship between outer and inner groups within the same group structure becomes problematic. Although previously noted as inherently unstable, this scenario appears manageable. Through practical implementation, I discovered that aligning secondary alignment patterns across Latin squares proves effective. When secondary alignment patterns differ in modulo form, simply switch to another matching pattern. This approach directly identifies congruent secondary alignment patterns between Latin squares, likely due to their inherent properties. This discovery has fueled my ongoing exploration of deeper structural characteristics within Latin square systems. The proof process remains incomplete and will not be elaborated here.