by **RSW** » Tue Jan 25, 2022 11:32 pm

It took me a while to become comfortable with how the alternating inferences work. Please forgive me if what I say is completely obvious, but here is my simple take on it.

If you have a number of propositions zA, yB, xC, wD, vE... each of which can be either true or false, then the "strong" link zA=yB means that either zA is true or yB is true, or both are true. In other words, at least one of them must be true. A "weak" link yB-xC means that either yB is false or xC is false, or both are false. In other words, at least one of them must be false.

(Because of the way these links work with the "at least" condition, I think that the terms "strong" and "weak" are poorly chosen, but it's too late to change the terminology.)

The strong and weak links have no influence on any proposition other than the two that are immediately connected by the link. So, we don't need to remember anything from elsewhere in the chain as we traverse it.

Now, if we string together the propositions by alternating strong and weak links to get, for example:

zA=yB-xC=wD

it's straightforward to work through the logic to show that the relationship between the first and last proposition is:

zA=wD

Similarly, if the chain starts and ends with weak links:

yB-xC=wD-vE

then the relationship between the first and last proposition is:

yB-vE

These examples are for chains with 4 propositions and 3 links, but it's straightforward to work through the logic to show that this holds for chains of any length (as long as the first and last links are of the same type).

So far, no mention has been made of cells or candidates, or even Sudoku. The logic behind AICs can be applied to any problem that can be stated as described above. In the case of Sudoku, we can specify that proposition zA means "digit z is the solution digit for cell A". The proposition has not necessarily been proven.

Now we can build a list of strong links by analyzing the puzzle grid to get the strong links, the simplest types being bivalue cells and bilocal digits. For example, a bivalue cell strong link will be of this form:

rA=sA

Note that the cell is the same but the digits are different.

For a bilocal digit strong link, we have this form:

pA=pB

In this case the digit is the same but the cells are different.

From more complicated patterns such as ALS's we can get derived strong links where both the candidate digits and the cells are different:

rA=sB

Consequently, X-chains and XY-chains are just subtypes of AICs.

Note that in each of these cases, the strong link can be reduced to the same general form of two candidate digits, and two cells. (Group links require more information, but they will be considered later.) From this, it can be seen that the logic involved in finding AICs can be split into two parts. First, build a dataset of all of the strong and weak links. Second, traverse the the set of links, alternating strong and weak, to generate a chain. Doing it this way, knowledge of how the link is derived is only required when building the dataset. The second step of generating the chain requires no knowledge of the links' origins.

For group links, such as grouped X-links, then more complex logic is required to find the link when building the strong link table, and more complex logic is also required to find the related weak links between the grouped strong links. However, once this information has been added to the dataset, they are once again just strong and weak links, and the logic that traverses the data doesn't need to know how they were originally derived.

This is how I implemented my AIC finder. The code finds all of strong links and puts them into a table. Then it finds all of the weak links between every combination of strong links and puts them into a table. Once this is done, the logic used for the traversal of the links and building of the AICs is very simple.

Over time, as I analyze more puzzle patterns to find new ways of generating strong links, I can add these to the dataset building part of the program, while the traversal part of the code remains unchanged.

The point that I'm making here, is that it's a good idea to look at the more abstract nature of AICs, and getting comfortable with that, before jumping into the fine details of how they apply in Sudoku.