Sudoku Programmers Forum Index

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log inLog in          Games  Calendar

Log in to check your private messagesLog in to check your private messages   

Top95: Our common benchmark?
Goto page Previous  1, 2, 3, 4
 
Post new topic   Reply to topic    Sudoku Programmers Forum Index -> Solving sudoku
View previous topic :: View next topic  
Author Message
Bob Hanson

Joined: 05 Oct 2005
Posts: 187
:
Location: St. Olaf College

Items
PostPosted: Tue Nov 08, 2005 6:35 pm    Post subject: Reply with quote

I apologize again for the long URL!!!!
Quote:
Yes, I'm using bifurcating chains as described by Nick70, with the exception of course that he didn't describe the proof in which a placement may be false.

Ah, OK. Understant that what I am doing in this table is the "reverse logic" proof, thus avoiding the bifurcation business.

Quote:

But it's clear that the diagram you posted didn't do that quite right. Where there should be b's, there are c's. Oddly enough though there are still C's, which shouldn't even be possible under the circumstances. You have a j in column 9 that never propagated K's in the next step. I believe your solver is looking at the first clue it can propagate, and then moving on without propagating others. That doesn't explain the missing b's, but it does explain how you could have a j and a v in the same constraint. That shouldn't be possible because the j should propagate K's all through column 9 for the 6's.


I'm not sure what you mean by the missing b's now. We have "a" as a starting point here, then "B", then "b". I have to start with "a" in reverse logic, because the hypothesis is "X can be eliminated." (lower case there for "eliminated")

a-->B (nodes that, if TRUE, would force X to be eliminated)
B-->b (nodes that, if FALSE, would force B to be TRUE....)
b-->C (nodes that, if TRUE, would force b to be FALSE....)

There are two "b"s: r3c2#3 and r8c3#3.
They are members of the strong chain r3c2#3--r2c3#3--r8c3#3. The center of those being "B" allows the other two to be set to "b".

I think it goes from there, right?

One of the problems may be that Nick was setting a node TRUE and then trying to prove that, as I recall. But that only worked because his TRUE node was strongly connected to a FALSE node. I start with the FALSE node (X can be eliminated), as that turns out to be the generally useful situation. ("X cannot be eliminated" would not work in this fashion for a weakly associated node -- one that has nothing that can force it TRUE). Maybe that's where I am confusing you. I admit -- it is VERY confusing.

Honestly, I wouldn't push this example too far. Just do a different one in Sudoku Assistant and check the table yourself. When the Table pops up, it has all the logic used just below it. You could print that and follow it along.

If you do that and you want the "reverse" logic, as this table has, be sure to select the "proof" option, not the default "disproof" one.

As much as I appreciate first realizing this for reverse "X can be eliminated" logic, I have to say that it is far easier to understand with the "standard" tabulation instead. If you are doing this because you are implementing bifurcation, ok, you have to use the forward logic, but understand that bifuraction should not be necessary, because there is always a "forward logic" alternative, even for "forward bifurcation" (as long as subset elimination has been taken care of previously).
_________________
Bob Hanson
Professor of Chemistry
St. Olaf College
Northfield, MN
http://www.stolaf.edu/people/hansonr
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Lummox JR

Joined: 07 Sep 2005
Posts: 202
:

Items
PostPosted: Wed Nov 09, 2005 11:19 pm    Post subject: Reply with quote

Bob Hanson wrote:
I apologize again for the long URL!!!!
Quote:
Yes, I'm using bifurcating chains as described by Nick70, with the exception of course that he didn't describe the proof in which a placement may be false.

Ah, OK. Understant that what I am doing in this table is the "reverse logic" proof, thus avoiding the bifurcation business.

I don't really get what you're saying then. I know you coined the term "reverse logic" but I'd figured it was just another way of saying bifurcating chains, since that's the actual name of Nick70's technique. (Actually it's bifurcating implication chains, but the middle part is, well, implied.)
Quote:
Quote:
But it's clear that the diagram you posted didn't do that quite right. Where there should be b's, there are c's. Oddly enough though there are still C's, which shouldn't even be possible under the circumstances. You have a j in column 9 that never propagated K's in the next step. I believe your solver is looking at the first clue it can propagate, and then moving on without propagating others. That doesn't explain the missing b's, but it does explain how you could have a j and a v in the same constraint. That shouldn't be possible because the j should propagate K's all through column 9 for the 6's.


I'm not sure what you mean by the missing b's now. We have "a" as a starting point here, then "B", then "b". I have to start with "a" in reverse logic, because the hypothesis is "X can be eliminated." (lower case there for "eliminated")

a-->B (nodes that, if TRUE, would force X to be eliminated)
B-->b (nodes that, if FALSE, would force B to be TRUE....)
b-->C (nodes that, if TRUE, would force b to be FALSE....)

Okay, I think when you're saying "reverse logic" you mean "bifurcating chains proving a placement false". I don't see the need for a new term here, since it's still the bifurcating chains technique--just using a forced-false proof instead of a forced-true proof. And it still bifurcates.
Quote:
There are two "b"s: r3c2#3 and r8c3#3.
They are members of the strong chain r3c2#3--r2c3#3--r8c3#3. The center of those being "B" allows the other two to be set to "b".

The concept of strong vs. weak chains is one that's handled by other techniques; bifurcating chains doesn't really use this concept. Still, in the graph you posted, you'll note those are both shown as c's, not b's. That's part of what I've been on about.
Quote:
I think it goes from there, right?

One of the problems may be that Nick was setting a node TRUE and then trying to prove that, as I recall. But that only worked because his TRUE node was strongly connected to a FALSE node. I start with the FALSE node (X can be eliminated), as that turns out to be the generally useful situation. ("X cannot be eliminated" would not work in this fashion for a weakly associated node -- one that has nothing that can force it TRUE). Maybe that's where I am confusing you. I admit -- it is VERY confusing.

I think we're on the same page, or would be if the terminology wasn't getting in the way. I would strongly discourage coming up with terms like "reverse logic" when clearly this is still just the bifurcating chains technique with a different starting point. Indeed you'll note on that thread that I got to the same conclusion, that using a false starting point could be useful, but never felt obliged to give the technique a new name.

As for false-placement proofs being generally more useful, I concur. But the true-placement ones Nick first used can find inconsistencies, which are also useful. In my solver I just find the first inconsistency and use it, but if you let the algorithm run to conclusion I'm sure you can sometimes find more. And by inconsistency I mean that you may have a G and the A within the same constraint, meaning that particular G placement proves A true. If they're in the same constraint they can't both be true, so that G is false.
Quote:
As much as I appreciate first realizing this for reverse "X can be eliminated" logic, I have to say that it is far easier to understand with the "standard" tabulation instead. If you are doing this because you are implementing bifurcation, ok, you have to use the forward logic, but understand that bifuraction should not be necessary, because there is always a "forward logic" alternative, even for "forward bifurcation" (as long as subset elimination has been taken care of previously).

I don't follow here, since the method you're using is essentially bifurcating anyway; it just looks like you're not following it far enough at each step, which is far less useful.
Back to top
View user's profile Send private message
Bob Hanson

Joined: 05 Oct 2005
Posts: 187
:
Location: St. Olaf College

Items
PostPosted: Wed Nov 09, 2005 11:50 pm    Post subject: Reply with quote

I'm sorry about the reverse logic idea. It isn't bifurcation, but it is equivalent to it -- that's what I learned from Nick.

In short, what I learned from Sudoku Assistant is that Nick's "forward bifurcation" was unnecessary. If he had instead picked a slightly different node -- one that was in the same chain as the one he did choose, then he could have come up with the EXACT same implication in a forward, no-bifurcation sense.

It's a little complicated, for sure.

I think it goes like this:

normal forcing logic, without bifurcation or application of the {?FFFF} --> {TFFFF} trick gets stuck.

One way around this is via bifurcation. (If a or b or c, then .... X can be eliminated.) Nick called this a verity or proof, I think., but it's tricky, because he expressed it as "X cannot be eliminated" but that was just because he HAPPENED to pick a conjugate pair.

Ey. I don't know if I'm explaining this well. Bear with me.

Another way around this is via normal forcing logic with application of the {?FFFF} --> {TFFFF} trick. (All except one is false in a group allows us to set the last one TRUE and continue with implications). No bifurcation is necessary. The result is a proof that the hypothesis "A is TRUE" is false, allowing us to eliminate A.

These two methods are equivalent.

BUT, it turns out that you can go the other way -- The sort of reverse logic that Nick was doing -- his innovation to build the table "backward" back to his bifurcation proved that the bifurcation worked.

I -- unfortunately, perhaps -- used that reverse tabling for my first analysis, and it worked. Voile! All Sudokus attempted solved. But it worked only when I stated the hypothesis "X can be eliminated", not "X cannot be eliminated."

In the end, I implemented the logic both ways and showed the bifurcation is simply not necessary -- picking the correct hypothesis on the correct set of nodes you can use standard, forward logic "disproof" at Sudoku Assistant -- and it all works just fine. You just have to be sure to apply the {?FFFFF} --> {TFFFFF} trick.

Next step, if this still doesn't make any sense is for me to show the forward -- normal -- table that corresponds to Nick's reverse one, with no bifurcation and the same result. I'm happy to do that. Should I?
_________________
Bob Hanson
Professor of Chemistry
St. Olaf College
Northfield, MN
http://www.stolaf.edu/people/hansonr
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Lummox JR

Joined: 07 Sep 2005
Posts: 202
:

Items
PostPosted: Thu Nov 10, 2005 12:48 am    Post subject: Reply with quote

I guess where I'm losing you is that it looks like both techniques are trying to prove the same thing. That is, you're trying to prove the hypothesis that a certain value is false, and that's where you put the a. I can understand "forward" in terms of a placement proving/disproving other placements, or contradicting itself, and "reverse" in terms of the bifurcating chains technique starting with the end result and trying to prove that from other a set of choices which must be true.

I'm not sure I get the whole {?FFFF} -> {TFFFF} thing, since that's not how Nick70's bifurcating chains work. Instead, it's {F????}->{FTTTT} and {?TTTT}->{FTTTT}. "Forward", if I understand the way you're using it, would indeed be {?FFFF}->{TFFFF} and {T????}->{TFFFF}, but the graph you posted doesn't show that. (You did mention that one was reverse, though, so maybe I'm basing too much of this off your graph.)

And I still don't see how your method is avoiding bifurcation. The graph you built is still doing just that, only at a much lesser degree by not following up fully at each step. I'm also not sure I see how a forward version (checking a placement to see what it reveals) could show more than a reverse version (looking for which placements prove a thesis).
Back to top
View user's profile Send private message
Bob Hanson

Joined: 05 Oct 2005
Posts: 187
:
Location: St. Olaf College

Items
PostPosted: Thu Nov 10, 2005 1:02 am    Post subject: Reply with quote

Please understand that I have stopped using this reverse business myself, in favor of the forward, normal logic. It took me some time to realize the equivalence, and the connection to bifurcation. But now that I see that you can use FORWARD--normal--logic to avoid bifurcation just as well as reverse, I see no particular point in going that way. The table that initiated this discussion was "reverse" -- providing a proof that "X can be eliminated". Instead, I now think it much more sensible and understandable to do it the normal way and just not do the bifurcation, since it APPEARS to not be necessary.

Maybe we should just forget about that table and start with a new one.

Take a look at this one:

http://www.stolaf.edu/people/hansonr/sudoku/tableexample.htm

This is, I think, the same Sudoku that Nick was introducing. The logic trail shows how the hypothesis "Chain 1(1) cannot be eliminated."

results in:

g: found that the hypothesis leads to both states for r4c5#1.
The hypothesis is disproven.

This is essentially the same as what Nick was trying to do, with no bifurcation.
_________________
Bob Hanson
Professor of Chemistry
St. Olaf College
Northfield, MN
http://www.stolaf.edu/people/hansonr
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Lummox JR

Joined: 07 Sep 2005
Posts: 202
:

Items
PostPosted: Thu Nov 10, 2005 1:59 am    Post subject: Reply with quote

Well, I definitely don't get that table. I see the forward aspect of it, but I don't understand this:
Quote:
g: found either state for r4c5#1 leads to the same conclusion

Same conclusion as...? It's not clear.

It does look, though, like the conclusion is that A can be eliminated, contrary to the hypothesis.

It looks like the killer clue is at F in r4d1 where two of the placements are true. So really, no g's need to be placed. It seems clearer to describe it with these terms at the beginning and end:

Testing hypothesis that r4c1=2:
...
This leads to two 1's in row 4, proving that r4c1<>2.
Back to top
View user's profile Send private message
Bob Hanson

Joined: 05 Oct 2005
Posts: 187
:
Location: St. Olaf College

Items
PostPosted: Thu Nov 10, 2005 4:05 am    Post subject: Reply with quote

Sorry. I saw that and changed the bottom but not the top. It should read:

g: found that the hypothesis leads to both states for r4c5#1

What has happened is that F has set both r4c3#1 and r4c5#1 TRUE.
However, these are conjugate pairs. One must be false and one true.
In the final step, g, we try to "set" r4c5#1 FALSE, because if r4c3#1 is TRUE, then it must be FALSE. But we have just set it TRUE, so it can't be both TRUE and FALSE, and the hypothesis, "Chain 1(1) cannot be eliminated" is FALSE. Chain 1(1) CAN be eliminated. Chain 1 in this case is r6c1#2 and r4c1#2. The hypothesis was that r4c1#2 could NOT be eliminated -- A. But that was proven false, so r4c1#2 CAN be eliminated. And the solution progresses.

Yes, that's right. We could have stopped at Step F. It's a bit more expensive to check for all-TRUE rows than simply a node conflict, so that's what the algorithm is doing here. It checks the all-TRUEness only once a cycle, and it's already done that in this cycle.

Since it's the last step, it probably doesn't pay to make this more efficient. But, yes, one could stop just before this as well, at F.

Anyway, I hope you agree -- no bifurcation necessary. Just straight A --> a --> B --> b ---> C ---> etc.
_________________
Bob Hanson
Professor of Chemistry
St. Olaf College
Northfield, MN
http://www.stolaf.edu/people/hansonr
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Lummox JR

Joined: 07 Sep 2005
Posts: 202
:

Items
PostPosted: Thu Nov 10, 2005 4:51 am    Post subject: Reply with quote

Bob Hanson wrote:
Sorry. I saw that and changed the bottom but not the top. It should read:

g: found that the hypothesis leads to both states for r4c5#1

What has happened is that F has set both r4c3#1 and r4c5#1 TRUE.
However, these are conjugate pairs. One must be false and one true.
In the final step, g, we try to "set" r4c5#1 FALSE, because if r4c3#1 is TRUE, then it must be FALSE. But we have just set it TRUE, so it can't be both TRUE and FALSE, and the hypothesis, "Chain 1(1) cannot be eliminated" is FALSE. Chain 1(1) CAN be eliminated. Chain 1 in this case is r6c1#2 and r4c1#2. The hypothesis was that r4c1#2 could NOT be eliminated -- A. But that was proven false, so r4c1#2 CAN be eliminated. And the solution progresses.

Yes, that's right. We could have stopped at Step F. It's a bit more expensive to check for all-TRUE rows than simply a node conflict, so that's what the algorithm is doing here. It checks the all-TRUEness only once a cycle, and it's already done that in this cycle.

That being the case, couldn't you just make it output the logic for the 2-true solution? If it finds such a conflict (which it should regardless of conjugate pairs, unless it's a constraint with all values false), it can simply report it then. Rather than saying that r4c5 is both true and false, which doesn't really jibe with the graph, why not say that 1 appears in both r4c3 and r4c5? (Or for all-false cases, you could say that 3 can't appear in c7, etc.) It seems like your output is serving the algorithm, not the other way around. Obviously it's easier to find the conflict, but it makes more sense to say why than to describe the conflict itself.
Quote:
Anyway, I hope you agree -- no bifurcation necessary. Just straight A --> a --> B --> b ---> C ---> etc.

Well, I wouldn't call this a lack of bifurcation because the chain is still splitting. It's really A --> aaa --> BB --> bbbbbb --> CC --> ccc --> D --> etc. The truth or falsehood of any placement at any given step may rely on several of the intermediate steps.
Back to top
View user's profile Send private message
rkral

Joined: 21 Oct 2005
Posts: 233
:

Items
PostPosted: Thu Nov 10, 2005 12:14 pm    Post subject: Reply with quote

Lummox JR wrote:
Code:
+----------------------+----------------------+----------------------+
| 6      289    279    | 2789   4      15789  | 125    129    3      |
|        hHB    HgB    | EH            FeFFF  |  D      F            |
| 489    1      2349   | 23689  2568   689    | 246    7      569    |
| GgB           BBBa   | CbCCB  dEEE   gHB    | DfG           eFB    |
| 479    2349   5      | 23679  1267   1679   | 8      12469  169    |
| fGB    CbCB          | ECH     EH     H     |        FeFFF  HgH    |
+----------------------+----------------------+----------------------+
| 14789  4689   14679  | 5      678    2      | 13467  134689 16789  |
| HGgHH  H         HB  |         H            | DcDDD   D      HH    |
| 3      568    167    | 4678   9      4678   | 1567   168    2      |
|        G        H    |                H     | GfGG                 |
| 45789  24689  24679  | 1      678    3      | 467    4689   56789  |
| GfGGG   H        HB  |                      | G             FH     |
+----------------------+----------------------+----------------------+
| 145    346    8      | 2467   12567  1467   | 9      23     167    |
| gGF    CgH           | eFFF   FEeFF  HHHh   |        Dc     HHh    |
| 149    7      13469  | 24689  1268   14689  | 23     5      168    |
| HGg           CbCCB  | D   H   D       H H  | cC             H     |
| 2      569    169    | 6789   3      156789 | 167    168    4      |
|        fGG      B    |                FH    |                      |
+----------------------+----------------------+----------------------+


At the point below, I can't justify putting a 'd' at r2c5#2:
Code:

 *-----------------------------------------------------------------------------*
 | 6       289     279     | 2789    4       15789   | 125     129     3       |
 |           B       B     |                         |  D                      |
 | 489     1       2349    | 23689   2568    689     | 246     7       569     |
 |   B             BBBa    | CbCCB             B     | D                 B     |
 | 479     2349    5       | 23679   1267    1679    | 8       12469   169     |
 |   B     CbCB            |  C                      |                         |
 |-------------------------+-------------------------+-------------------------|
 | 14789   4689    14679   | 5       678     2       | 13467   134689  16789   |
 |                     B   |                         | DcDDD    D              |
 | 3       568     167     | 4678    9       4678    | 1567    168     2       |
 |                         |                         |                         |
 | 45789   24689   2467B   | 1       678     3       | 467     4689    56789   |
 |                         |                         |                         |
 |-------------------------+-------------------------+-------------------------|
 | 145     346     8       | 2467    12567   1467    | 9       23      167     |
 |         C               |                         |         Dc              |
 | 149     7       13469   | 24689   1268    14689   | 23      5       168     |
 |                 CbCCB   | D        D              | cC                      |
 | 2       569     169     | 6789    3       156789  | 167     168     4       |
 |                   B     |                         |                         |
 *-----------------------------------------------------------------------------*

r2c5#2 and r2c7#2 are not a conjugate pair, so it must have something to do with the fact that other 2's in r2 are already "pencilmarked" ... but I don't understand the reason those other 2's can be ignored. Would someone please explain? TIA, Ron
Back to top
View user's profile Send private message
Lummox JR

Joined: 07 Sep 2005
Posts: 202
:

Items
PostPosted: Thu Nov 10, 2005 8:28 pm    Post subject: Reply with quote

It's not conjugates that matter in bifurcating chains, but rather when placing false values you must find a constraint that's filled with all true values except for one unfilled placement. Every other 2 in row 2 is marked true: B, C, and D. The only one left is r2c5=2. If that is false, one of the others is true, and if one of those is true then the hypothesis is true.
Back to top
View user's profile Send private message
Bob Hanson

Joined: 05 Oct 2005
Posts: 187
:
Location: St. Olaf College

Items
PostPosted: Fri Nov 11, 2005 4:07 pm    Post subject: Reply with quote

Lummox JR:

That's a fine idea -- even if it doesn't catch the {TTT}, at least check for it just before exiting and report it that way. It's the last step--we know there is an elimination, just reporting it slightly differently. OK, that's implemented that way now in http://www.stolaf.edu/people/hansonr/sudoku


bifurcation: My impressioni was that "bifurcation" refers to the parallel checking of multiple possibilities:

If X then either

Y, in which case......

or

Z, in which case......

To me, that's fundamentally different in concept than simply going


If X then ....

then .....

then .....

Which is all we are (or at least I am) doing here. One can show that, in the end, the two arrive at identical results, provided one includes recognition that {?FFFFF} --> {TFFFFF} in "nonbifurcating" logical analysis.

I guess if you want to say that adding that consideration amounts to "bifurcation" I guess you can. But there are still two fundamentally different ways --programming wise-- of getting to that same conclusion. One that (I think, maybe?) requires some sort of keeping of parallel records and cross-checking, and one that just follows the logical consequences directly. Maybe I misuderstand how one would implement "bifurcation". I don't know.

rkral: right, with this "reverse logic" technique, it's that last "All TRUE except 1 unknown forces the last FALSE".

Again, you don't need to do this sort of reverse logic unless you really like it. (I've decided it drives me nuts.) The same conclusion could be arrived at using simple "normal forcing" logic simply by initially placing an A at r2c3#9 and following the logic in the standard implicating way. (Since r2c3 is 9, it can't be 2, 3, or 4.) Then "B" would become "a", "b" would become "B", "C" would become "b", etc. until, in the end, row 2#2 would be "all false except for r2c5" and we could place a "D" there and continue. In the end, if we arrive at a logical inconsistency, then you say, "Oh, OK then, in that case I WILL eliminated r2c3#9."

If that didn't make any sense, or you are not convinced, try Sudoku Assistant, the "Proof" sample. Solve it first using "disproof" (the normal forcing logic route) and then solve it also using the "proof" (as you and Lummox JR are doing, above) method. Then compare the logic trails.

They will be nearly identical.
_________________
Bob Hanson
Professor of Chemistry
St. Olaf College
Northfield, MN
http://www.stolaf.edu/people/hansonr
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Lummox JR

Joined: 07 Sep 2005
Posts: 202
:

Items
PostPosted: Fri Nov 11, 2005 7:08 pm    Post subject: Reply with quote

Bob Hanson wrote:
bifurcation: My impressioni was that "bifurcation" refers to the parallel checking of multiple possibilities:

If X then either

Y, in which case......

or

Z, in which case......

To me, that's fundamentally different in concept than simply going


If X then ....

then .....

then .....

Which is all we are (or at least I am) doing here. One can show that, in the end, the two arrive at identical results, provided one includes recognition that {?FFFFF} --> {TFFFFF} in "nonbifurcating" logical analysis.

I guess if you want to say that adding that consideration amounts to "bifurcation" I guess you can. But there are still two fundamentally different ways --programming wise-- of getting to that same conclusion. One that (I think, maybe?) requires some sort of keeping of parallel records and cross-checking, and one that just follows the logical consequences directly. Maybe I misuderstand how one would implement "bifurcation". I don't know.

The only way that this would not be bifurcation would be if you followed a direct chain from one true/false clue to the next. But each step can affect multiple true/false clues, which is where the bifurcation comes in. Otherwise you'd be working with conjugate pairs (pretty much), which I believe is identical to your medusa analysis.

Basically here you've got a chain of singles--naked or hidden. Any time you can use {?FFFF}->{TFFFF} to place a new true clue, you've found a new single in the chain. Problem is, singles don't always interact in the direct way you'd expect, so if one appears it may have been revealed by several different steps along the line.

So this isn't so much bifurcation by OR as by AND. It's not that the one choice leads to multiple possible chains with all the same conclusion, but rather that the one choice represents a single branching chain whose endpoints are a set of conclusions. If you go backwards as in Nick70's technique, from conclusion to steps that prove it, you have multiple starting points joined by OR with a common endpoint, vs. the forward method of a common starting point with multiple endpoints joined by AND. This sort of AND/OR symmetry is common in boolean logic, as I'm sure you're aware. Both chains bifurcate because they either start or end with a commonality.
Back to top
View user's profile Send private message
Lummox JR

Joined: 07 Sep 2005
Posts: 202
:

Items
PostPosted: Fri Nov 11, 2005 7:27 pm    Post subject: Reply with quote

You know, in just ruminating over my last post, I realized you could probably amp up this technique considerably by combining both the forward and reverse methods. Say I want to prove a placement (A) true, and also show 1) what implies it, and 2) what it implies.

If you go after 2 first, of course, you'll be able to find out if A is invalid.

If A is invalid by the forward method, then the reverse will tell you which other placements you could eliminate as a result. Any marker, true or false, that shows up in that analysis is wrong. When you think about it this is huge. You can eliminate all positive markers, and place any negative ones. You also know at this point that two negatives will not coexist, or a constraint will not be all positive, because those would have proved A true which it is not.

If A is plausible by the forward method (since you can't confirm it's true that way, even if you fill the grid), you can use reverse to confirm its truth. That will tell you if 1) it's possible to prove A true, or else 2) if any placements within the same constraint (i.e., same digit same house, or different digit same cell) imply A, thus contradicting themselves. I thought it might also be possible to say that if the same placement implies A while true but is proved false by A, or vice-versa, it must be wrong; but I can find no logic to back that up.

This is also easy to do with standard bifurcating chains (reverse order) alone. That is, if you hypothesize a and prove it, that placement is false. Set that to A and do the analysis again, but eliminate any true markers and place the false markers. So no matter what results you pull out of bifurcating chains, you can say this: If a placement is false, any placement or elimination that implied it is wrong.
Back to top
View user's profile Send private message
Bob Hanson

Joined: 05 Oct 2005
Posts: 187
:
Location: St. Olaf College

Items
PostPosted: Fri Nov 11, 2005 8:51 pm    Post subject: Reply with quote

Quote:

You know, in just ruminating over my last post, I realized you could probably amp up this technique considerably by combining both the forward and reverse methods. Say I want to prove a placement (A) true, and also show 1) what implies it, and 2) what it implies.

You could, but it's totally unnecessary and probably not especially productive. Saying "if A is TRUE" allows only for efficient forward-directed logic -- " then x,y,z can't be TRUE". That is, you can ask, "What would lead to A being TRUE?" but except in the case of your happening to have chosen a strong-chain node, it's not of value.

My "discovery" if there is one, is that there are three sorts of nodes:

(A) strong-chain nodes. These constitute what people call "conjugate pairs" along with cells that have only two possibilities.

(B) Weakly associated nodes. Or "buddies" of strong nodes. These don't generally have a "F-->T" implication for anything --- except in the {?FFFF}-->{TFFFF} sense that if enough of them get set FALSE, then it's possible that some node can be assigned TRUE. (Using forward, not "bifurcating" logic here.)

(C) nonassociated nodes. These aren't buddies of any strong node, so setting them TRUE or FALSE doesn't have any significant implication.

Implications:

(A) These have F-->T and T-->F implications for others in their chain, and T-->F implications for any weakly associated nodes of their particular "parity" anywhere on the chain. "Weak links" arise when a TRUE on one chain node delivers a FALSE on a different strong chain, thus expanding the implications to that new chain. Testing Both parities of a chain to T tests ALL nodes of that chain at once.

(B) These have T-->F implications for their associated strong chains.

(C) These have no implicates for strong chains, and only T-->F implications for weak nodes. Sudoku Assistant using the "Medusa" strategy suggests that these can be ignored.

While it is true that you could do both forward and reverse, there will be nothing to gain in doing that. Either is just as good, but one does absolutely nothing more than the other. So why do both? All this would do would be to reorganize what gets done first, and maybe result in duplication.

Quote:

If A is invalid by the forward method, then the reverse will tell you which other placements you could eliminate as a result. Any marker, true or false, that shows up in that analysis is wrong. When you think about it this is huge. You can eliminate all positive markers, and place any negative ones. You also know at this point that two negatives will not coexist, or a constraint will not be all positive, because those would have proved A true which it is not.

The forward logic suggesting "If A is TRUE then...." is exactly identical to the reverse logic based on "if the following, then A will be FALSE." So there's absolutely no reason to do both.

The forward logic suggesting "If A is FALSE then..." serves a purpose ONLY with strong chain nodes. It is identical to saying, "If [partner of A] is TRUE then...". Since weak nodes don't have conjugates in this sense, there is no need to ever start with "If A is FALSE then..." because the answer is most probably "nothing."

Quote:

If A is plausible by the forward method (since you can't confirm it's true that way, even if you fill the grid), you can use reverse to confirm its truth. That will tell you if 1) it's possible to prove A true, or else 2) if any placements within the same constraint (i.e., same digit same house, or different digit same cell) imply A, thus contradicting themselves. I thought it might also be possible to say that if the same placement implies A while true but is proved false by A, or vice-versa, it must be wrong; but I can find no logic to back that up.

If the forward method: "If A is TRUE then...." comes up empty, then you can ask "What would force A to be FALSE." This is the identical question, it turns out. If instead you mean ask "What would force A to be TRUE", then that's a different question. BUT there's no advantage to asking it because (A) with strong nodes, this just asks the question you were going ask later on that same chain, opposite parity, and (B) if it's a weak node, then it won't lead anywhere. (Sorry)

Quote:

This is also easy to do with standard bifurcating chains (reverse order) alone. That is, if you hypothesize a and prove it, that placement is false. Set that to A and do the analysis again, but eliminate any true markers and place the false markers. So no matter what results you pull out of bifurcating chains, you can say this: If a placement is false, any placement or elimination that implied it is wrong.

Ah, that would be great. I think if you consider this more, you'll see the problem. It's the difference between forward "AND" and reverse "OR". Say you do hypothesize and prove something. Note that the "reverse" bifurcation logic only really allows you to say "I can eliminate this node." NOT "I can assign this number HERE." Not generally, at least.

Yes, if you discover that you can set a chain node FALSE, then you get to set ALL the chain nodes for that whole chain -- TRUE and FALSE right down the line. That's the Medusa idea. Identify the connections and just check THE WHOLE CHAIN at once -- just two checks necessary for all the nodes of that chain.

But you can't extend that idea to weakly associated nodes. That is, you can't say, "Ah, now that I know I can eliminated this node, I know that all the TRUES I marked are TRUE." No, all you know is that ONE of those is TRUE.

I think the confusion may arise in that when originally communicated, the logic was delivered as though we could answer the hypothesis "A is TRUE" using "reverse" bifurating logic. Unfortunately, this worked only because the specific node chosen in that example happened to be a strong-chain node. So what was more generally being asked was "Can the conjugate of A be eliminated." Had the puzzle been different and no such strong node would lead to a solution, then that strategy would have failed. If you need an example, I can get one. I just have to have Sudoku Assistant only look at strong nodes. We will find an example then that can't proceed without also testing weak nodes either in the reverse sense ("Can this node be eliminated?") or in the normal forward sense ("What are the implications of assigning this cell this value?"). No need to check both, though, as it's exactly the same analysis.
_________________
Bob Hanson
Professor of Chemistry
St. Olaf College
Northfield, MN
http://www.stolaf.edu/people/hansonr
Back to top
View user's profile Send private message Send e-mail Visit poster's website
rkral

Joined: 21 Oct 2005
Posts: 233
:

Items
PostPosted: Sat Nov 12, 2005 4:49 pm    Post subject: Reply with quote

Lummox JR wrote:
It's not conjugates that matter in bifurcating chains, but rather when placing false values you must find a constraint that's filled with all true values except for one unfilled placement.

Thanks for the explanation. I coded Nick70's implication chain algorithm and tested it on the candidate layout discussed earlier. My code produced some differences ... I think caused by a missed 'F' at r1c7#5 and a missed 'H' at r9c3#1.
Lummox JR wrote:

Code:
+----------------------+----------------------+----------------------+
| 6      289    279    | 2789   4      15789  | 125    129    3      |
|        hHB    HgB    | EH            FeFFF  |  D      F            |
| 489    1      2349   | 23689  2568   689    | 246    7      569    |
| GgB           BBBa   | CbCCB  dEEE   gHB    | DfG           eFB    |
| 479    2349   5      | 23679  1267   1679   | 8      12469  169    |
| fGB    CbCB          | ECH     EH     H     |        FeFFF  HgH    |
+----------------------+----------------------+----------------------+
| 14789  4689   14679  | 5      678    2      | 13467  134689 16789  |
| HGgHH  H         HB  |         H            | DcDDD   D      HH    |
| 3      568    167    | 4678   9      4678   | 1567   168    2      |
|        G        H    |                H     | GfGG                 |
| 45789  24689  24679  | 1      678    3      | 467    4689   56789  |
| GfGGG   H        HB  |                      | G             FH     |
+----------------------+----------------------+----------------------+
| 145    346    8      | 2467   12567  1467   | 9      23     167    |
| gGF    CgH           | eFFF   FEeFF  HHHh   |        Dc     HHh    |
| 149    7      13469  | 24689  1268   14689  | 23     5      168    |
| HGg           CbCCB  | D   H   D       H H  | cC             H     |
| 2      569    169    | 6789   3      156789 | 167    168    4      |
|        fGG      B    |                FH    |                      |
+----------------------+----------------------+----------------------+

My code wrote:
Code:

+---------------------+----------------------+---------------------+
| 6      289    279   | 2789   4      15789  | 125    129    3     |
|        hHB    HgB   | EHhH          FeFFF  | fDF    GFg          |
| 489    1      2349  | 23689  2568   689    | 246    7      569   |
| GgB           BBBa  | CbCCB  dEEE   gHB    | DfG           eFB   |
| 479    2349   5     | 23679  1267   1679   | 8      12469  169   |
| fGB    CbCB         | ECH     EH     H     |        FeFFF  GgH   |
+---------------------+----------------------+---------------------+
| 14789  4689   14679 | 5      678    2      | 13467  134689 16789 |
| HGgHH  H         HB |         H            | DcDDD   D   H  HH   |
| 3      568    167   | 4678   9      4678   | 1567   168    2     |
|        G        H   |                H     | GfGG                |
| 45789  24689  24679 | 1      678    3      | 467    4689   56789 |
| GfGGG   H     h  HB |                      | G         H   FH    |
+---------------------+----------------------+---------------------+
| 145    346    8     | 2467   12567  1467   | 9      23     167   |
| gGF    CgH          | eFFF   FEeFF  HHHh   |        Dc     HHh   |
| 149    7      13469 | 24689  1268   14689  | 23     5      168   |
| HGg           CbCCB | D   H   D       H H  | cC             H    |
| 2      569    169   | 6789   3      156789 | 167    168    4     |
|        fGG    HhB   |                FH    | G                   |
+---------------------+----------------------+---------------------+

FWIW the original puzzle is #283 of the top870, and duplicated as #342.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Sudoku Programmers Forum Index -> Solving sudoku All times are GMT
Goto page Previous  1, 2, 3, 4
Page 4 of 4

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Sudoku Programmers topic RSS feed 


Powered by phpBB © 2001, 2005 phpBB Group

Igloo Theme Version 1.0 :: Created By: Andrew Charron