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   

Bifurcating Implication Chains == Trebor's Tables
Goto page Previous  1, 2, 3  Next
 
Post new topic   Reply to topic    Sudoku Programmers Forum Index -> Solving sudoku
View previous topic :: View next topic  
Author Message
AMcK

Joined: 07 Apr 2005
Posts: 89
:
Location: Cambridge

Items
PostPosted: Thu Oct 20, 2005 2:55 pm    Post subject: Reply with quote

I'm also quite inspired by Nick70's discovery and am getting similar results having programmed the algorithm in my solver. The reverse "pencilling" is unnecessary because the implication matrix has all the information necessary. Here's the trace for the Nick70's example puzzle which finds r4c1 to be a "magic cell".
Code:

Veritables
Veritables in row 4: r4c3<>1 or r4c5<>1 imply r5c3=1 or r8c3=1 or r7c5=1 or r8c5=1
... which all imply r4c1<>2 r6c1=2 r6c5<>2 r6c6<>2 r1c3=3 r1c6<>3 r3c1<>3 r3c5=3 r4c1=3 r4c9<>3 r5c3<>3 r5c7=3 r7c5<>3 r7c9=3 r9c6=3 r9c7<>3 r1c3<>4 r3c5<>4 r7c9<>4 r1c3<>6 r6c1<>6 r7c9<>6 r9c6<>6 r1c3<>7 r3c5<>7 r5c7<>7 r7c9<>7 r4c1<>8 r6c1<>8 r9c6<>8 r4c1<>9 r5c7<>9 r6c1<>9
Reduction: r4c1<>2 before=2389 after=389
r4c1<>2 implies r6c1=2
Forcing: r6c1=2 before=2689 after=2
r6c1=2 implies r6c5<>2
Reduction: r6c5<>2 before=278 after=78
r6c1=2 implies r6c6<>2
Reduction: r6c6<>2 before=2789 after=789
Forcing: r1c3=3 before=3467 after=3
r1c3=3 implies r1c6<>3
Reduction: r1c6<>3 before=23678 after=2678
r1c6<>3 implies r3c1<>3
Reduction: r3c1<>3 before=369 after=69
r3c1<>3 implies r3c5=3
Forcing: r3c5=3 before=347 after=3
r3c5=3 implies r4c1=3
Forcing: r4c1=3 before=389 after=3
r4c1=3 implies r4c9<>3
Reduction: r4c9<>3 before=367 after=67
r4c9<>3 implies r5c3<>3
Reduction: r5c3<>3 before=1379 after=179
r5c3<>3 implies r5c7=3
Forcing: r5c7=3 before=379 after=3
r5c7=3 implies r7c5<>3
Reduction: r7c5<>3 before=13478 after=1478
r7c5<>3 implies r7c9=3
Forcing: r7c9=3 before=3467 after=3
r7c9=3 implies r9c6=3
Forcing: r9c6=3 before=368 after=3
r9c6=3 implies r9c7<>3
Reduction: r9c7<>3 before=1368 after=168
Veritables: 32 mS

The algorithm can clearly be generalised greatly in the manner of Mad Overlord's original "verities"
- any pair of interlocking houses rather than rows/columns
- arbitrary pairs of cells where there are more than than two possibles in the "row"
- equalities as well as inequalities in the "row"
- arbitrary number of candidate cells in the "columns"
- proving inequalities as well as equalities
Some of these are now working - but I suspect I need more of them to solve puzzles like "toughest" that only tabling can currently solve.
Regards
Andrew
Back to top
View user's profile Send private message Send e-mail
Nick70

Joined: 08 Jun 2005
Posts: 160
:

Items
PostPosted: Thu Oct 20, 2005 6:14 pm    Post subject: Reply with quote

AMcK wrote:
Some of these are now working - but I suspect I need more of them to solve puzzles like "toughest" that only tabling can currently solve.

Yesterday I added to my solver the additional logic to extend the colouring algorithm, and it solved the "thoughest" puzzle.

THe only additions needed were the ones mentioned here:

1) if all colours in a unit exclude colour x, then x is false
2) if all colours in a unit except x exclude y, then every colour excluded by x excludes y.

After 2) you need to compute the closure again.
Back to top
View user's profile Send private message
Lummox JR

Joined: 07 Sep 2005
Posts: 202
:

Items
PostPosted: Thu Oct 20, 2005 7:39 pm    Post subject: Reply with quote

Of course it's worth adding that those two rules apply only when you have a unit filled with colors. This is the case for methods which apply colors to every placement. Some forms of supercoloring do that; others don't. I think it's helpful to do so if you use these rules, but of course that makes it brutal to solve by hand.
Back to top
View user's profile Send private message
AMcK

Joined: 07 Apr 2005
Posts: 89
:
Location: Cambridge

Items
PostPosted: Sat Oct 22, 2005 6:51 pm    Post subject: Reply with quote

Nick70 wrote:

1) if all colours in a unit exclude colour x, then x is false
2) if all colours in a unit except x exclude y, then every colour excluded by x excludes y

Put them into my solver and tried them out on the bifurcating example and toughest but got no hits at all.
Can you give me some hints about where I should find hits for the two patterns.
Regards
Andrew
Back to top
View user's profile Send private message Send e-mail
rkral

Joined: 21 Oct 2005
Posts: 233
:

Items
PostPosted: Sat Oct 22, 2005 8:34 pm    Post subject: Re: Bifurcating Implication Chains == Trebor's Tables Reply with quote

On Oct 9
Nick70 wrote:
Here is an example:

Code:
1      2467   3467   | 24678  5      23678  | 678    4678   9     
5      24679  4679   | 1      2478   26789  | 678    3      467   
369    4679   8      | 4679   347    679    | 2      5      1     
---------------------+----------------------+---------------------
2389   5      179    | 2789   1278   4      | 679    2679   367   
4      179    1379   | 5      6      1279   | 379    279    8     
2689   6789   679    | 3      278    2789   | 4      1      5     
---------------------+----------------------+---------------------
689    14689  2      | 4678   13478  1678   | 5      46789  3467 
689    3      1469   | 24678  12478  5      | 16789  46789  467   
7      146    5      | 468    9      368    | 1368   468    2     

r4c3<>1 =>
   r5c3=1 => r5c3<>3 => r5c7=3
   r8c3=1 => r9c2<>1 => r9c7=1 => r9c7<>3 => r5c7=3


Ran across the above today while browsing to learn a few things about chaining and coloring. I got lost real quick.

I can see where r4c3<>1 => r4c5=1 => r5c6<>1, but don't see how that implies r5c3=1 since r5c3 and r5c6 are not 1's conjugates. r4c3 and r5c3 aren't conjugates either. What am I missing?

TIA, Ron
Back to top
View user's profile Send private message
Nick70

Joined: 08 Jun 2005
Posts: 160
:

Items
PostPosted: Sun Oct 23, 2005 12:18 am    Post subject: Re: Bifurcating Implication Chains == Trebor's Tables Reply with quote

rkral wrote:
On Oct 9
Nick70 wrote:
Code:
r4c3<>1 =>
   r5c3=1 => r5c3<>3 => r5c7=3
   r8c3=1 => r9c2<>1 => r9c7=1 => r9c7<>3 => r5c7=3


I can see where r4c3<>1 => r4c5=1 => r5c6<>1, but don't see how that implies r5c3=1 since r5c3 and r5c6 are not 1's conjugates. r4c3 and r5c3 aren't conjugates either. What am I missing?

You are missing that the chain bifurcates. r4c3<>1 doesn't imply that r5c3=1. It implies that EITHER r5c3=1 OR r8c3=1. Both assertions eventually imply that r5c7=3.
Back to top
View user's profile Send private message
rkral

Joined: 21 Oct 2005
Posts: 233
:

Items
PostPosted: Mon Oct 24, 2005 10:18 am    Post subject: Re: Bifurcating Implication Chains == Trebor's Tables Reply with quote

Nick70 wrote:
Code:
r4c3<>1 =>
   r5c3=1 => r5c3<>3 => r5c7=3
   r8c3=1 => r9c2<>1 => r9c7=1 => r9c7<>3 => r5c7=

It implies that EITHER r5c3=1 OR r8c3=1. Both assertions eventually imply that r5c7=3.


Duh! Your original post explained that quite well. I apologize for reading the 'code' and NOT studying the accompanying text.

Guessing that the original puzzle looks like ...
Code:
 
*-----------*
|1..|.5.|..9|
|...|1..|.3.|
|..8|...|2..|
|---+---+---|
|.5.|..4|...|
|4..|.6.|..8|
|...|3..|.1.|
|---+---+---|
|..2|...|5..|
|.3.|..5|...|
|7..|.9.|..2|
*-----------*


... I get to the following (using Angus's Simple Sudoku program) ...
Code:

*--------------------------------------------------------------------*
| 1      2467   3467   | 24678  5      23678  | 678    4678   9      |
| 5      24679  4679   | 1      2478   26789  | 678    3      467    |
| 369    4679   8      | 4679   347    679    | 2      5      1      |
|----------------------+----------------------+----------------------|
| 2389   5      179    | 2789   1278   4      | 679    2679   367    |
| 4      179    1379   | 5      6      1279   | 379    279    8      |
| 2689   6789   679    | 3      278    2789   | 4      1      5      |
|----------------------+----------------------+----------------------|
| 689    14689  2      | 4678   13478  1678   | 5      46789  3467   |
| 689    3      1469   | 24678  12478  5      | 16789  46789  467    |
| 7      1468   5      | 468    9      1368   | 1368   468    2      |
*--------------------------------------------------------------------*


... which differs from your example only in r9c2 and r9c6.

Would you please advise how you excluded the 8 from r9c2 and the 1 from r9c6?


Last edited by rkral on Mon Oct 24, 2005 7:19 pm; edited 2 times in total
Back to top
View user's profile Send private message
Nick70

Joined: 08 Jun 2005
Posts: 160
:

Items
PostPosted: Mon Oct 24, 2005 1:26 pm    Post subject: Re: Bifurcating Implication Chains == Trebor's Tables Reply with quote

rkral wrote:
Would you please advise how did you excluded the 8 from r9c2 and the 1 from r9c6?

With other (not bifurcating) forcing chains.

Code:
r4c3=1 => r4c5<>1 => r5c6=1 => r9c6<>1
r5c3=1 => r5c3<>3 => r5c7=3 => r9c7<>3 => r9c6=3 => r9c6<>1
r8c3=1 => r8c7<>1 => r9c7=1 => r9c6<>1

r4c1=8 => r4c1<>3 => r5c3=3 => r5c7<>3 => r9c7=3 => r9c7<>1 => r9c2=1 => r9c2<>8
r6c1=8 => r6c1<>2 => r4c1=2 => r4c1<>3 => r5c3=3 => r5c7<>3 => r9c7=3 => r9c7<>1 => r9c2=1 => r9c2<>8
r6c2=8 => r9c2<>8
Back to top
View user's profile Send private message
rkral

Joined: 21 Oct 2005
Posts: 233
:

Items
PostPosted: Mon Oct 24, 2005 7:35 pm    Post subject: Re: Bifurcating Implication Chains == Trebor's Tables Reply with quote

Nick70 wrote:
rkral wrote:
Would you please advise how did you excluded the 8 from r9c2 and the 1 from r9c6?

With other (not bifurcating) forcing chains.


Wow, thanks for the explanation. It seems fair to say that each exclusion was made with 'trifurcating forcing chains.' Smile

I don't expect I'll be writing code to do that anytime soon. Sad
Back to top
View user's profile Send private message
Bob Hanson

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

Items
PostPosted: Mon Oct 24, 2005 10:47 pm    Post subject: Reply with quote

I'm learning a lot reading about your implication chains. Very slick. Basically what Medusa analysis does is carry your "bifurcation" idea to the ultimate -- checking all possibilities at once by grouping strong chains and then linking them. (But you are definitely doing more than I am here.)

About magic cells -- the presence or absence of magic cells simply depends upon the logical capabilities of the solver, I think. Do you agree? So, for example, that 54-magic cell example at
http://www.research.att.com/~gsf/sudoku/

Code:

.23 .56 7..
... 7.. ...
7.9 .3. ..4
..8 ... 3..
6.. ..2 ...
..4 8.. ..1
... ..7 8..
5.1 9.. ..7
8.. .45 6..



Though not capable of being solved using X- and Y-cycle analysis, does fall right away using Medusa chains. (Essentially what you are doing here, but focusing on the strong chains and their implications. In this case

http://www.stolaf.edu/people/hansonr/sudoku/index.htm?,-2,-3,,-5,-6,-7tt-7tt-7,,-9,,-3t,-4t-8t,-3t-6t,,-2tt-4,-8t,,-1tt-7,-8t-5,,-1,-9t,,-7,-8t,-4,-5,-6

So I guess my question is, isn't a "magic cell" simply an indication that one's logic is not extensive enough? It isn't like a Sudoku "has" a magic cell, right? Just that within a certain algorithmic framework some cells get you out of trouble, and some don't.

Is that right?


[/code]
_________________
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
Bob Hanson

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

Items
PostPosted: Tue Oct 25, 2005 5:05 am    Post subject: Reply with quote

Fascinating! Here is the Medusa chain analysis for your system.

Strong Chains: 9 total, only 3 of interest here:

Chain 3
5 r1c3#3 chain 3(1)
6 r1c6#3 chain 3(0)
7 r3c1#3 chain 3(0)
8 r4c1#3 chain 3(1)
9 r3c5#3 chain 3(1)
10 r5c3#3 chain 3(0)
15 r4c9#3 chain 3(0)
21 r5c7#3 chain 3(1)
22 r7c5#3 chain 3(0)
25 r9c6#3 chain 3(1)
28 r7c9#3 chain 3(1)
29 r9c7#3 chain 3(0)

Chain 5
13 r4c3#1 chain 5(1)
14 r4c5#1 chain 5(0)
18 r5c6#1 chain 5(1)
23 r7c6#1 chain 5(0)

Chain 8
26 r8c7#1 chain 8(1)
27 r9c7#1 chain 8(0)
32 r9c2#1 chain 8(1)

Weak links and corners:

[r5c3#3 chain 3(0)]0--r5c3#1--1[r4c3#1 chain 5(1)] corner
[r4c3#1 chain 5(1)]1--r8c3#1--1[r8c7#1 chain 8(1)] corner
[r9c7#3 chain 3(0)]0--r9c7#6--0[r9c7#1 chain 8(0)] link



Code:

n(m) means "chain n, parity m". - means false, + means true

r4c3<>1 =>
 -5(1)

   r5c3=1 => r5c3<>3 => r5c7=3
   +corner     -3(0)    +3(1)
or
   r8c3=1 => r9c2<>1 => r9c7=1 => r9c7<>3 => r5c7=3
   +corner   -8(1)      +8(0)     -3(0)      +3(1)
 

r4c3=1 ==> r4c5<>1 =>
 +5(1)      -5(0)

   r7c5=1 => r7c5<>3 => r9c6=3 => r9c7<>3 => r5c7=3
   corner     3(0)       3(1)       3(0)      3(1)
or
   r8c5=1 => r8c7<>1 => r9c7=1 => r9c7<>3 => r5c7=3
   corner     8(1)       8(0)       3(0)      3(1)



So what you have done is check the implications on chain 3 of setting chain 5 to both parities. Once you have the chain data shown above you can shorten this analysis considerably:

Code:


(I) r4c3<>1  ==  -5(1)

   r5c3=1 => r5c3<>3
   +corner     -3(0)   == +3(1)
or
   r8c3=1 => r9c2<>1
   +corner   -8(1)   ==> +3(1)
 
(II) r4c3=1
    +5(1)   ==> +3(1) directly



Either (I) or (II) is true, and in either case, we have Chain 3 with parity 1.

That means we can instantly set the 3(1) cells to their characteristic values:

Chain 3
5 r1c3#3 chain 3(1)
8 r4c1#3 chain 3(1)
9 r3c5#3 chain 3(1)
25 r9c6#3 chain 3(1)
28 r7c9#3 chain 3(1)
21 r5c7#3 chain 3(1)

and eliminate all of these:

6 r1c6#3 chain 3(0)
7 r3c1#3 chain 3(0)
10 r5c3#3 chain 3(0)
15 r4c9#3 chain 3(0)
22 r7c5#3 chain 3(0)
29 r9c7#3 chain 3(0)

I think that's pretty efficient!

But can't this be done the other way around as well? And with nothing more than the following three pieces of Medusa information:

From:

a) [r5c3#3 chain 3(0)]--r5c3#1--[r4c3#1 chain 5(1)] corner
b) [r4c3#1 chain 5(1)]--r8c3#1--[r8c7#1 chain 8(1)] corner
c) [r9c7#3 chain 3(0)]--r9c7#6--[r9c7#1 chain 8(0)] link

We have, assuming +3(0):

+3(0) =(c)=> -8(0) == +8(1) =(b)=> r8c3<>1

and

+3(0) =(a)=> r5c3<>1

and

+3(0) =(a)=> r4c3<>1

A logical inconsistency. All three of these can't be <>1, so we must have +3(1), not +3(0).

A simple follow through of "what if Chain 3 is parity 0" (that is, all the 3(0) nodes are TRUE and all the 3(1) nodes are eliminated) would result in the number of possibilities of 1 in column 3 going to zero -- enough to conclude chain 3 is in parity 0.

Actually, it's simpler than that. (b) and (c) can be written simply:

d) [r9c7#3 chain 3(0)]--r8c3#1--[r4c3#1 chain 5(1)] corner

So then we just have:

a) [r5c3#3 chain 3(0)]--r5c3#1--[r4c3#1 chain 5(1)] corner
d) [r9c7#3 chain 3(0)]--r8c3#1--[r4c3#1 chain 5(1)] corner

Obviously 3(0) cannot turn OFF r5c3#1, r8c3#1, AND r4c3#1!!!!

Right now http://www.stolaf.edu/people/hansonr/sudoku is not linking corners this way, but it certainly could easily enough. Then it's just a check for direct implications of setting a chain to one parity or another. An elimination of the maximum allowable values in any row, column, or block constitutes disproof of that hypothesis.

Notice that once we have collected the Medusa chain information, which is very easy to do, we no longer focus on implication chains of specific cells, just specific chain states. This amounts to checking your sort of string of logic simultaneously.

I think starting with what is at the Sudoku Assistant, one could generalize your logic to ALL such conclusions in a very small amount of code.
_________________
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
Bob Hanson

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

Items
PostPosted: Wed Oct 26, 2005 7:57 pm    Post subject: Reply with quote

Thanks to all here.

The Sudoku Assistant

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

now solves 59 of the puzzles on the top95 list.

Provided that the "implication chains" follow simple rules of strong and weak chains, the 3D Medusa analysis takes care of most "bifurcations" -- at least those starting with strong chains. (If chain "X" is in state "0/1"....)

In implementing this I see my logic above was incorrect. I said:

From:

a) [r5c3#3 chain 3(0)]--r5c3#1--[r4c3#1 chain 5(1)] corner
b) [r4c3#1 chain 5(1)]--r8c3#1--[r8c7#1 chain 8(1)] corner
c) [r9c7#3 chain 3(0)]--r9c7#6--[r9c7#1 chain 8(0)] link

We have, assuming +3(0):

+3(0) =(c)=> -8(0) == +8(1) =(b)=> r8c3<>1

and

+3(0) =(a)=> r5c3<>1

and

+3(0) =(a)=> r4c3<>1

But since (a) and (b) are corners, we can't use them in this way.
Hmm... In any case, thanks. I will implement the forward-directed proof provided by Nik70 shortly.
_________________
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
Bob Hanson

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

Items
PostPosted: Thu Oct 27, 2005 2:59 pm    Post subject: Reply with quote

Nick70's analysis is brilliant! Here is a way of thinking about it without any ifurcation. We use Medusa chains

(http://www.stolaf.edu/people/hansonr/sudoku)


A "the hypothesis that r5c7 is 3"

Medusa: really what this says is that Chain 3, of which r5c7#3 is a +(1) member, must be in state (1). But I'll leave it at just this cell for now:

A: r5c7#3

a "all nodes that, when false, make A true"

Medusa: All 3(0) nodes

a: r1c6#3, r3c1#3, r4c9#3, r5c3#3, r7c5#3, r9c7#3

B "all nodes that, when true, make (a) false"

Medusa: All additional 3(1) nodes and all 3(0)-associated weak nodes

B: r1c3#3, r3c5#3, r4c1#3, r7c9#3, r9c6#3*, and

r1c6#2, r1c6#6, r1c6#7, r1c6#8, r3c1#6, r3c1#9, r4c9#6, r4c9#7, r5c3#1, r5c3#7, r5c3#9, r7c5#1, r7c5#4, r7c5#7, r7c5#8, r9c7#1, r9c7#6, r9c7#8

(*Nick70's table has r9c6#3 eliminated, but that is not crucial to the analysis.)

The essential associated node is r9c7#1, which is a +(0) node of Chain 8 and allows progress to (b)

b "all nodes that, when false, make B true"

Medusa: All 8(1) nodes

b: r8c7#1

C: "All nodes that, when true, make b false"

Medusa: All weak 8(1) nodes:

C: r8c3#1, r8c5#1, r8c7#6, r8c7#7, r8c7#8, r8c7#9

of these, the crucial ones are the first two, r8c3#1 and r8c5#1.

[insert Nick70 brilliant idea here]

c: "All nodes that, when false force A, B, or C"

Look for columns, rows, blocks, and cells for which there are N possibilities and N-1 already assigned A, B, or C. Then the Nth can be assigned c. These include:

r4c3#1 and r4c5#1

Medusa: This is the end! r4c3#1 is chain 5 +(1), and r4c5#1 is chain 5 +(0). Thus, any state of chain 5 forces A, and chain 3 must be +(1).
This instantly sets all the following 3(1) nodes true:

r7c5#3, r1c3#3, r3c5#3, r4c1#3, r7c9#3, r9c6#3

What is interesting, I think, is that this entire analysis can be initiated simply with the question, "Is Chain N +(1)?"

There are only 12 chains in this Sudoku. How long can it take?

I believe this is the missing link that I needed to make the Sudoku Assistant take the next step. Right now it solve 60/95 top95 puzzles, but that is just considering 3D strong chains and their associated weak links and corners. The critical missing pieces for me is the forcing of "false" nodes by (N-1) completion of row/column/block/cell sets.

In this case, the false nodes that are set are r4c3#1 and r4c5#1, with opposite parity. This then forces the final step of the proof.

Alternatively, only one could be recognized. This would force "D" to the other one, and then we would have another untenable situation: all possibilites for #1 in either column 3 or 5 leading to A. Either way, A must be true.

I guess what I don't understand here is where the "bifurcation" comes in. Or, perhaps what I mean is --- using Medusa chains, the bifurcation business drops out. You can just follow the logic directly.

Thanks VERY much for this, Nick70!
_________________
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
Bob Hanson

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

Items
PostPosted: Sun Oct 30, 2005 6:35 am    Post subject: Reply with quote

I have implemented Nick70's "reverse logic" in the Sudoku Assistant:

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

with explanation at

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

the specific parts of the code relating to this logic can be found in

http://www.stolaf.edu/people/hansonr/sudoku/logic.js


Mind you, Javascript is not particulary speedy. But it is fun to see the logic laid out like this. In particular, the code recognizes a couple of other forcing conditions not mentioned by Nick70:

1. Maybe it's obvious, but single cells are just as valid as rows, columns, and blocks for this logic -- if N-1 of N marks in a cell have been labeled with capitals to indicate "If TRUE, then A is TRUE", then that last remaining mark in that cell can be set "If FALSE, then A is TRUE."

2. A corrolary condition is that if for any subset two marks have been labeled with lower case letters (If FALSE then A is TRUE), then A is TRUE, because at least ONE of those two must be FALSE.

For reference, here is a puzzle from top95 that the Sudoku Assistant required "reverse logic" to solve:

Code:

..2 47. .58
... ... ...
... ..1 .4.
... .2. ..9
528 19. 4..
..9 ... 125
2.. ... .3.
3.. ..7 5.2
685 ..2 ...


In this case the analysis went like this:

Checking reverse logic
Logic Test 10(0):
A: The question is this: Is Chain 10(0) TRUE?,
A: setting r5c9#3 TRUE chain 10 parity 0,
A: setting r5c6#6 TRUE chain 10 parity 0,
a: A is TRUE, if chain 10(1) is FALSE,
a: setting r5c6#3 FALSE chain 10 parity 1,
a: setting r4c7#3 FALSE chain 10 parity 1,
B: A is TRUE, if any of the following weakly associated nodes 10(1) are TRUE:,
B: setting r1c6#3 TRUE ,
B: setting r4c4#3 TRUE ,
B: setting r2c6#3 TRUE ,
B: setting r4c6#3 TRUE ,
B: setting r6c6#3 TRUE ,
B: setting r6c4#3 TRUE ,
B: setting r6c5#3 TRUE ,
B: setting r1c7#3 TRUE ,
B: setting r4c2#3 TRUE ,
B: setting r2c7#3 TRUE ,
B: setting r4c3#3 TRUE ,
B: setting r3c7#3 TRUE ,
B: setting r4c7#6 TRUE ,
B: setting r4c7#8 TRUE ,
c: row 1 is nearly all TRUE for #2, so a FALSE there forces one of the others TRUE,
c: 3x3 block 4 is nearly all TRUE for #8, so a FALSE there forces one of the others TRUE,
c: row 6 is nearly all TRUE for #2, so a FALSE there forces one of the others TRUE,
c: A is TRUE, if any of the weak nodes are forced to be TRUE by the following being FALSE:,
c: setting r1c2#3 FALSE ,
c: setting r6c2#3 FALSE ,
C: setting r1c1#3 TRUE in same row if TRUE forces r1c2#3 FALSE,
C: setting r1c2#1 TRUE in same cell if TRUE forces r1c2#3 FALSE,
C: setting r2c2#3 TRUE in same column if TRUE forces r1c2#3 FALSE,
C: setting r1c2#2 TRUE in same cell if TRUE forces r1c2#3 FALSE,
C: setting r3c2#3 TRUE in same column if TRUE forces r1c2#3 FALSE,
C: setting r2c1#3 TRUE in same block if TRUE forces r1c2#3 FALSE,
C: setting r1c2#4 TRUE in same cell if TRUE forces r1c2#3 FALSE,
C: setting r1c2#5 TRUE in same cell if TRUE forces r1c2#3 FALSE,
C: setting r6c2#3 TRUE in same column if TRUE forces r1c2#3 FALSE,
C: found either state for r6c2#3 results in A being TRUE,
r5c6 ISN'T 3: Reverse logic test: Chain 10(0) must be TRUE.
r4c7 ISN'T 3: Reverse logic test: Chain 10(0) must be TRUE.

So, there you have it! An excellent addition.
Sudoku Assistant now solves 65/95 of top95.

What I especially like about this is how easy it is to describe in human terms.

OK, that's about it for me. I'm satisfied that:

a) Nick70's bifurcation is a special case of a much wider "N-1 True implies FALSE" reverse logic.

b) there is a rich variety of techniques waiting to be found for solving Sudoku puzzles.

c) just about everything I can think of short of guessing is demonstrated easily with the Sudoku Assitant.

Thanks again, Nick.
_________________
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
Bob Hanson

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

Items
PostPosted: Mon Oct 31, 2005 9:49 pm    Post subject: Reply with quote

whoah!

Sure enough, adding Nick70s reverse logic does in fact phenomonally improve the Sudoku Assistant solving of top95. Now it's up to 86/95. The big jump occurred when I allowed it to use reverse logic to answer the question, "Can Node X be eliminated?" where Node X is a weak node that is not itself part of a strong chain. (Strong chain nodes have been taken care of already with the question, "Can Chain N have parity {0 or 1}?")


For reference,

"node" in my parlance is a specific (cell row, column, and candidate value) -- a "mark" on a marked-up Sudoku.

"strong chain" is a linked set of nodes that force each other TRUE/FALSE/TRUE/FALSE....

"weak node", then, is a node that is in the same row, column, block, or cell as a strong node but not itself in that chain. Weak nodes (a) if TRUE set the parity of their associated strong chains, and (b) get set FALSE if their assocated strong chain is set specifically to one of its two possible parities.


see

http://www.stolaf.edu/people/hansonr/sudoku?6.2.5.........4.3..........43...8....1....2........7..5..27...........81...6.....
_________________
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
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  Next
Page 2 of 3

 
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