## Continuous Loops with ALS nodes

Advanced methods and approaches for solving Sudoku puzzles

### Re: Continuous Loops with ALS nodes

SpAce wrote:(2=79)r2c2-(79=4)r2c39-(4=1)r4c3-(1=2)r4c2

That does make sense if the first instance of "79" is read as "7 or 9" and the second as "7 and 9". For some reason that way of reading it wasn't intuitive to me.

To avoid misunderstandings, we write -(7|9=2)r2c2. If 7 or 9 is missing in 479/479, the 4 must be there ...

I would write the loop as (2=4)r4c23-(4=2)r2c239, loop.
This is also a double-linked ALS-XZ.
Another approach is:
You have 5 digits in the 5 cells. None can be in 2 of the cells. So eliminate all in the rest of their units.

In JC's second example you have 5 digits 14678 in 6 cells.
Only the 7 can be in 2 of the cells. Eliminate 1468 from the rest of their units.
Then look, where the 7's can go to, and you will find more eliminations.
eleven

Posts: 2112
Joined: 10 February 2008

### Re: Continuous Loops with ALS nodes

eleven wrote:
SpAce wrote:(2=79)r2c2-(79=4)r2c39-(4=1)r4c3-(1=2)r4c2

That does make sense if the first instance of "79" is read as "7 or 9" and the second as "7 and 9". For some reason that way of reading it wasn't intuitive to me.

To avoid misunderstandings, we write -(7|9=2)r2c2. If 7 or 9 is missing in 479/479, the 4 must be there ...

(I assume you mean (2=7|9)?) I agree that it's much clearer that way. However, the problem is that in the original direction you don't need that OR-pipe:

(2=1)r4c2-(1=4)r4c3-(4=79)r2c39-(79=2)r2c2

In that chain the "79" can be read as "7 and 9" in both cases, right? The confusion arises only when we reverse that chain and the "and" relationship is no longer valid. My goal is to write a chain so that it can be reversed without any modifications to the notation or the semantics. It appears to be a bit challenging with ALS nodes around, especially if the "bystander" digits are included.

I would write the loop as (2=4)r4c23-(4=2)r2c239, loop.

Sure, it's the simplest way to do it and avoids the complications that the bystanders cause with reversibility. However, I think we established in the previous thread why keeping the bystanders around is useful, especially in continuous loops. By itself your loop doesn't make it at all clear which digits can be eliminated and where. Simplicity has a price tag too.

This is also a double-linked ALS-XZ.

Yes, but my original point was that I don't care unless there's a good reason to. It's much simpler for me to treat it as just a generic continuous loop with an ALS-node (or two), because it's much easier for me to find it that way and I already know the elimination rules for it. I don't want to learn another complex pattern if I already know a more intuitive way to achieve the same effect. As far as I'm concerned, all ALS-patterns are incredibly unintuitive and difficult to spot as presented, but I can still understand and apply their functionality easily if I just think of them as chains. So, I'd rather forget about those patterns as such and continue seeing them as chains, unless someone can argue that I'm missing out on something with that approach.
-SpAce-: Show
Code: Select all
`   *             |    |               |    |    *        *        |=()=|    /  _  \    |=()=|               *            *    |    |   |-=( )=-|   |    |      *     *                     \  ¯  /                   *    `

"If one is to understand the great mystery, one must study all its aspects, not just the dogmatic narrow view of the Jedi."

SpAce

Posts: 1678
Joined: 22 May 2017

### Re: Continuous Loops with ALS nodes

SpAce wrote:(I assume you mean (2=7|9)?) I agree that it's much clearer that way. However, the problem is that in the original direction you don't need that OR-pipe:

(2=1)r4c2-(1=4)r4c3-(4=79)r2c39-(79=2)r2c2

If 7 and 9 are in r3c39, then "not (7 and 9)" in r2c2 is equivalent with "(7 or 9)" is not in r2c2. Logically it should be written also here. But since not both can be in one cell anyway, it looks correct.

... ALS-patterns are incredibly unintuitive and difficult to spot as presented, but I can still understand and apply their functionality easily if I just think of them as chains. So, I'd rather forget about those patterns as such and continue seeing them as chains, unless someone can argue that I'm missing out on something with that approach.

For me ALS patterns are simply n+1 digits in n cells. If one is missing, the others must be in there. If one of 3 digits must be missing in a 5 cell ALS, the other 3 must be there. That's it.
[Edit: n+1 confusion]
eleven

Posts: 2112
Joined: 10 February 2008

### Re: Continuous Loops with ALS nodes

eleven wrote:
SpAce wrote:(I assume you mean (2=7|9)?) I agree that it's much clearer that way. However, the problem is that in the original direction you don't need that OR-pipe:

(2=1)r4c2-(1=4)r4c3-(4=79)r2c39-(79=2)r2c2

If 7 and 9 are in r3c39, then "not (7 and 9)" in r2c2 is equivalent with "(7 or 9)" is not in r2c2. Logically it should be written also here. But since not both can be in one cell anyway, it looks correct.

You're right. Damn this is confusing! I think my mistake is a tendency to read AICs as bidirectional forcing chains which they're really not. That's why I didn't see the (79=2)r2c2 as illogical because, read from left to right, I just saw two candidates (7 and 9) eliminated from a single cell resulting in a single value (2), which seemed fine. Logically it should be (7|9=2) because the "=" is really an OR as well and "(79=2)r2c2" read as ((7 AND 9) OR 2) would imply that a single cell could hold two values. It should be ((7 OR 9) OR 2) which works both ways.

Btw, how would you write the whole chain using logic gates? I understand that "-" is NAND and "=" is OR but I can't get very far without getting confused if I try to apply them.

For me ALS patterns are simply n+1 digits in n cells. If one is missing, the others must be in there. If one of 3 digits must be missing in a 5 cell ALS, the other 3 must be there. That's it.

I understand that (though not always without thinking yet). What I meant was that I don't find the named ALS patterns (ALS-XZ, ALS-XY-Wing, etc) very helpful for practical purposes.

PS. I'd be interested in your input on my AHS-notation question as well:
http://forum.enjoysudoku.com/ahs-notation-nightmare-nov-25-2007-t34317.html
-SpAce-: Show
Code: Select all
`   *             |    |               |    |    *        *        |=()=|    /  _  \    |=()=|               *            *    |    |   |-=( )=-|   |    |      *     *                     \  ¯  /                   *    `

"If one is to understand the great mystery, one must study all its aspects, not just the dogmatic narrow view of the Jedi."

SpAce

Posts: 1678
Joined: 22 May 2017

### Re: Continuous Loops with ALS nodes

SpAce wrote:Btw, how would you write the whole chain using logic gates? I understand that "-" is NAND and "=" is OR but I can't get very far without getting confused if I try to apply them.

Never thought about that.

I am still thinking in implication chains, starting with
not A => B => not C => D,...,=> not W => X
Since (not A => B) is logically equivalent with (not B => A), they are reversable like AIC's:
not X => W,..., not D => C => not B => A
So (not A)=>X and (not X) => A, i.e. one of A and X must be true (as well as one of C and X or one of B and W).
This is identical with AIC's, just written differently (and when going through a grid, i often leave out the not's, just think not A=>B=>D..=>X)

The implication X=>Y is logically (not X OR Y) <=> (X OR not Y)
So you get (A OR B) AND (not B OR C) AND (not C OR D), ..., AND (W OR X) or, because (not B or C) is equivalent to NOT (B AND not C)
(A OR B) NAND (B AND not C) AND (not C OR D), ...

not 4 in r2c39 => 79 in r2c39 => 79 not in r2c2 => 2r2c2 seems clear.
(7 and 9) not in r2c2 is the same as NOT (7 or 9) in r2c2
That way it is easy to translate it to the AIC (4=79)r2c39-(7|9=2)r2c2

But - if i got it right -
((4r2c3 OR 4r2c9) OR ((7 AND 9)(r2c3 AND r2c9) NAND ((7 AND 9)(r2c3 AND r2c9) AND NOT (7 OR 9)r2c2) AND (NOT (7 OR 9)r2c2 OR 2r2c2) ??
eleven

Posts: 2112
Joined: 10 February 2008

### Re: Continuous Loops with ALS nodes

Thanks, eleven! I appreciate your translation effort, and sorry it took me a while to get back to this. This stuff is surprisingly hard, but I think you helped me get a bit of a grasp. As your example demonstrates, this is obviously not a viable replacement for chains, especially when applied to all elements and if text is used instead of symbols. Still it doesn't hurt to understand this side of it too, even if it's not at all practical.

I agree with everything else you said (and trust your solution is correct), but one question:

eleven wrote:The implication X=>Y is logically (not X OR Y) <=> (X OR not Y)

I agree with "(not X OR Y)" but not with "<=> (X OR not Y)". The latter would translate into Y=>X, but we don't have that.

Another minor observation about this fragment: "(7 AND 9)(r2c3 AND r2c9)". If we wanted to be really complete, I guess that should be broken into pieces as well. Something horrible like ((7r2c3 AND 9r2c9) OR (9r2c3 AND 7r2c3))? Otherwise it could be interpreted so that both 7 and 9 could go into both of those cells. That being said, I don't think such level of detail is needed or even helpful when there's little chance of confusion. I made even more shortcuts in my solution to keep it somewhat readable.

I'm using the following symbols:

Code: Select all
`& = AND| = OR~ = NOT(I'm not using NAND because I don't want to invent a symbol for it, and I think it just kind of complicates things.)`

My translation attempt:

(2=1)r4c2 - (1=4)r4c3 - (4=79)r2c39 - (7|9=2)r2c2

<=>

((2)r4c2 | (1)r4c2) & ~((1)r4c2 & (1)r4c3)) & ((1)r4c3 | (4)r4c3) & ~((4)r4c3 & (4)r2c39)) & ((4)r2c39 | (7&9)r2c39) & ~((7&9)r2c39 & (7|9)r2c2) & ((7|9)r2c2 | (2)r2c2)

In a slightly more readable format (some parenthesis are implied):

Code: Select all
`(2=1)r4c2 - (1=4)r4c3 - (4=79)r2c39 - (7|9=2)r2c2             <=>  (2)r4c2    | (1)r4c2             &~((1)r4c2    & (1)r4c3)             &  (1)r4c3    | (4)r4c3             &~((4)r4c3    & (4)r2c3|9)             &  (4)r2c3|9  | (7&9)r2c39             &~((7&9)r2c39 & (7|9)r2c2)              &  (7|9)r2c2  | (2)r2c2             =>     (2)r4c2 | (2)r2c2 `

Then I did this:

Code: Select all
`(2=1)r4c2 - (1=4)r4c3 - (4=79)r2c39 - (7|9=2)r2c2            <=> (2)r4c2    |  (1)r4c2            &~(1)r4c2    | ~(1)r4c3            & (1)r4c3    |  (4)r4c3            &~(4)r4c3    | ~(4)r2c3|9            & (4)r2c3|9  |  (7&9)r2c39            &~(7&9)r2c39 | ~(7|9)r2c2            & (7|9)r2c2  |  (2)r2c2            =>    (2)r4c2 | (2)r2c2 `

Now it's actually somewhat understandable, and it's also easy to translate into both implication chains. If you're traversing the original chain forwards, then you're going down the right-hand column; if backwards, then you're going up the left-hand column. You can also easily skip the false nodes if you want to. In other words:

2r4c2 | (1r4c2 => 4r4c3 => (7&9)r2c39 => 2r2c2)
<=>
2r2c2 | ((7|9)r2c2 => (4)r2c3|9 => 1r4c3 => 2r4c2)
=>
2r2|4c2

What do you think? Personally I think that's a more intuitive format than mixing NANDs (or pseudo-NANDs) there. (But did I even get it right?)
-SpAce-: Show
Code: Select all
`   *             |    |               |    |    *        *        |=()=|    /  _  \    |=()=|               *            *    |    |   |-=( )=-|   |    |      *     *                     \  ¯  /                   *    `

"If one is to understand the great mystery, one must study all its aspects, not just the dogmatic narrow view of the Jedi."

SpAce

Posts: 1678
Joined: 22 May 2017

Previous