Eleven's variable replacement method and its complexity

Advanced methods and approaches for solving Sudoku puzzles

Re: Eleven's variable replacement method and its complexity

Postby denis_berthier » Thu Apr 07, 2022 5:47 am

.
7 months since the last post in this thread. I've been busy with other things and it had dropped off my mind, but some post in the Tridagon thread reminded me of this.
I now have a somewhat better view of the whole replacement process.

Let P be a puzzle and T a resolution theory. Suppose that, at some resolution state RS in the resolution path of P within T, the conditions for applying eleven's variable replacement method apply to 3 cells (it could be 4 or more, say n, we'll get similar results).

What the method does is indeed apply a clever form of T&E(BRT, 2) - more generally T&E(BRT, n-1) - to RS.
I say clever, because it factors branches of T&E, precisely those branches that don't depend on the specific values of x, y, z.... But it is fundamentally T&E(BRT, n-1).

This view explains both:
- why it can't be expressed as a resolution rule;
- why it can (apparently) reduce the T rating of a puzzle; what's measured after applying the method is no longer the T-rating, but a rating based on T and T&R(BRT, n-1).
And it corresponds to what's done in the proof of the method.
denis_berthier
2010 Supporter
 
Posts: 3970
Joined: 19 June 2007
Location: Paris

Re: Eleven's variable replacement method and its complexity

Postby eleven » Thu Apr 07, 2022 12:11 pm

Maybe this is a good place to give another example for applying the method.

This is one of the new 11.8's by hendrik_monard:
Code: Select all
98.76.5..7.54.98...46......69.8.7....57946.8.8.45..7..4.8...93......46.........2.

After placing 9r5c4 (TH) we get this grid (ER 9.8):
Code: Select all
 *----------------------------------------------------------------------*
 |  9      8      123    |  7     6      123    |  5      14    1234    |
 |  7      123    5      |  4     123    9      |  8      16    1236    |
 |  123    4      6      |  123   58     58     |  123    79    79      |
 |-----------------------+----------------------+-----------------------|
 |  6      9      123    |  8     123    7      |  1234   145   12345   |
 |  123    5      7      |  9     4      6      |  123    8     123     |
 |  8      123    4      |  5     123    123    |  7      69    69      |
 |-----------------------+----------------------+-----------------------|
 |  4      1267   8      |  126   57     125    |  9      3     157     |
 |  1235   1237   1239   |  123   5789   4      |  6      157   1578    |
 |  135    1367   139    |  136   5789   1358   |  14     2     14578   |
 *----------------------------------------------------------------------*

We replace 123 by xyz and (wlog) set r2,4,6 in c5 to x,y,z.
Code: Select all
 *----------------------------------------------------------------------*
 |  9      8      xyz    |  7     6      xyz    |  5      14    1234    |
 |  7      xyz    5      |  4     x      9      |  8      16    1236    |
 |  xyz    4      6      |  xyz   58     58     |  xyz    79    79      |
 |-----------------------+----------------------+-----------------------|
 |  6      9      xyz    |  8     y      7      |  xyz4   145   12345   |
 |  xyz    5      7      |  9     4      6      |  xyz    8     xyz     |
 |  8      xyz    4      |  5     z      xyz    |  7      69    69      |
 |-----------------------+----------------------+-----------------------|

With singles we get
Code: Select all
 *----------------------------------------------------------------------*
 |  9      8      xy     |  7     6      yz     |  5      14    1234    |
 |  7      z      5      |  4     x      9      |  8      16    1236    |
 |  xy     4      6      |  yz    58     58     | *xz-y   79    79      |
 |-----------------------+----------------------+-----------------------|
 |  6      9      xz     |  8     y      7      |  4-xyz  145   12345   |
 |  xz     5      7      |  9     4      6      | *xyz    8    *xyz     |
 |  8      y      4      |  5     z      x      |  7      69    69      |
 |-----------------------+----------------------+-----------------------|

Now y cannot be in r3c7 (would be forced to both r1c36).
x in r3c7 forces x in r5c1 (through r3c1,r14c3) and yz in r3c79.
z in r3c7 forces z in r5c1 (through r3c41) and xy in r3c79.
=> -xyzr4c7
[Edit: i made a mistake here, so i need another step:]
This gives singles 1r9c7, 4r4c7,r9c9,r1c8 and we get
Code: Select all
 *-----------------------------------------------------------------*
 |  9      8      xy     |  7     6      yz    |  5    4    xyz    |
 |  7      z      5      |  4     x      9     |  8    16   6-y    |
 |  xy     4      6      |  12    58     58    |  23   79   79     |
 |-----------------------+---------------------+-------------------|
 |  6      9      xz     |  8     y      7     |  4    15   xz5    |
 |  xz     5      7      |  9     4      6     |  23   8    xyz    |
 |  8      y      4      |  5     z      x     |  7    69   69     |
 |-----------------------+---------------------+-------------------|
Here it can be easily seen, that x in r1c9 forces z in r5c1 and vice versa, i.e. y in r5c9, so y must be in r15c9 => 6r2c9
Solves with skyscraper.
eleven
 
Posts: 3094
Joined: 10 February 2008

Re: Eleven's variable replacement method and its complexity

Postby denis_berthier » Fri Apr 08, 2022 4:21 am

.
A better example in relation with this thread is how I applied the method here:
http://forum.enjoysudoku.com/post316286.html?hilit=replacement#p316286

As you can see, when interpreted in terms of T&E, the 3rd and 4th steps are a version of T&E(2): you try to plug in 2 numbers (the 3rd is a consequence of them) and the combinations that are contradictory with the givens are eliminated.
Granted, my initial presentation with isomorphisms is smarter, as is your presentation with x,y,z variables, but remember, I'm talking of an interpretation in a different framework.
For my general philosophy on this point of interpretation, see here http://forum.enjoysudoku.com/the-t-e-depth-of-a-resolution-rule-t39888-5.html.
denis_berthier
2010 Supporter
 
Posts: 3970
Joined: 19 June 2007
Location: Paris

Re: Eleven's variable replacement method and its complexity

Postby eleven » Fri Apr 08, 2022 9:15 am

Yes, that's how you would program the method:
In the candidates grid replace all occurances of 1,2,3 (including the givens) by 123, then choose a unit with 123's only, place single digits 1,2,3 there and feed the solver with this sukaku.
Try it for all 123 only units and choose the one with the simplest solution (if you can find one).
In the solution then replace all 123's according to the givens to get a solution to the original puzzle.
However no one would do that manually.
eleven
 
Posts: 3094
Joined: 10 February 2008

Re: Eleven's variable replacement method and its complexity

Postby denis_berthier » Fri Apr 08, 2022 11:43 am

eleven wrote:Yes, that's how you would program the method:
[..]
However no one would do that manually.

OK. But the interpretation as T&E is not about manual solving. It's about explaining (apparent) reduction of complexity.
denis_berthier
2010 Supporter
 
Posts: 3970
Joined: 19 June 2007
Location: Paris

Re: Eleven's variable replacement method and its complexity

Postby totuan » Wed Dec 07, 2022 3:44 pm

eleven wrote:Maybe this is a good place to give another example for applying the method.
This is one of the new 11.8's by hendrik_monard:
Code: Select all
98.76.5..7.54.98...46......69.8.7....57946.8.8.45..7..4.8...93......46.........2.

After placing 9r5c4 (TH) we get this grid (ER 9.8):
Hidden Text: Show
Code: Select all
 *----------------------------------------------------------------------*
 |  9      8      123    |  7     6      123    |  5      14    1234    |
 |  7      123    5      |  4     123    9      |  8      16    1236    |
 |  123    4      6      |  123   58     58     |  123    79    79      |
 |-----------------------+----------------------+-----------------------|
 |  6      9      123    |  8     123    7      |  1234   145   12345   |
 |  123    5      7      |  9     4      6      |  123    8     123     |
 |  8      123    4      |  5     123    123    |  7      69    69      |
 |-----------------------+----------------------+-----------------------|
 |  4      1267   8      |  126   57     125    |  9      3     157     |
 |  1235   1237   1239   |  123   5789   4      |  6      157   1578    |
 |  135    1367   139    |  136   5789   1358   |  14     2     14578   |
 *----------------------------------------------------------------------*

We replace 123 by xyz and (wlog) set r2,4,6 in c5 to x,y,z.
Code: Select all
 *----------------------------------------------------------------------*
 |  9      8      xyz    |  7     6      xyz    |  5      14    1234    |
 |  7      xyz    5      |  4     x      9      |  8      16    1236    |
 |  xyz    4      6      |  xyz   58     58     |  xyz    79    79      |
 |-----------------------+----------------------+-----------------------|
 |  6      9      xyz    |  8     y      7      |  xyz4   145   12345   |
 |  xyz    5      7      |  9     4      6      |  xyz    8     xyz     |
 |  8      xyz    4      |  5     z      xyz    |  7      69    69      |
 |-----------------------+----------------------+-----------------------|

With singles we get
Code: Select all
 *----------------------------------------------------------------------*
 |  9      8      xy     |  7     6      yz     |  5      14    1234    |
 |  7      z      5      |  4     x      9      |  8      16    1236    |
 |  xy     4      6      |  yz    58     58     | *xz-y   79    79      |
 |-----------------------+----------------------+-----------------------|
 |  6      9      xz     |  8     y      7      |  4-xyz  145   12345   |
 |  xz     5      7      |  9     4      6      | *xyz    8    *xyz     |
 |  8      y      4      |  5     z      x      |  7      69    69      |
 |-----------------------+----------------------+-----------------------|

Now y cannot be in r3c7 (would be forced to both r1c36).
x in r3c7 forces x in r5c1 (through r3c1,r14c3) and yz in r3c79.
z in r3c7 forces z in r5c1 (through r3c41) and xy in r3c79.
=> -xyzr4c7
[Edit: i made a mistake here, so i need another step:]
This gives singles 1r9c7, 4r4c7,r9c9,r1c8 and we get
Code: Select all
 *-----------------------------------------------------------------*
 |  9      8      xy     |  7     6      yz    |  5    4    xyz    |
 |  7      z      5      |  4     x      9     |  8    16   6-y    |
 |  xy     4      6      |  12    58     58    |  23   79   79     |
 |-----------------------+---------------------+-------------------|
 |  6      9      xz     |  8     y      7     |  4    15   xz5    |
 |  xz     5      7      |  9     4      6     |  23   8    xyz    |
 |  8      y      4      |  5     z      x     |  7    69   69     |
 |-----------------------+---------------------+-------------------|
Here it can be easily seen, that x in r1c9 forces z in r5c1 and vice versa, i.e. y in r5c9, so y must be in r15c9 => 6r2c9
Solves with skyscraper.

Code: Select all
 *--------------------------------------------------------------------*
 | 9      8     *123    | 7      6     *123    | 5      14     1234   |
 | 7     *123    5      | 4     *123    9      | 8      16     1236   |
 |*123    4      6      |*123    58     58     | 123    79     79     |
 |----------------------+----------------------+----------------------|
 | 6      9     *123    | 8     #123    7      |A1234   145    12345  |  A => impossible pattern
 |*123    5      7      | 9      4      6      |#123    8      123    |    => r4c7=4
 | 8     *123    4      | 5     #123   #123    | 7      69     69     |
 |----------------------+----------------------+----------------------|
 | 4      1267   8      | 126    57     125    | 9      3      157    |
 | 1235   1237   1239   | 123    5789   4      | 6      157    1578   |
 | 135    1367   139    | 136    5789   1358   | 14     2      14578  |
 *--------------------------------------------------------------------*
 *-----------------------------------------------------------*
 | 9     8    *123   | 7     6    *123   | 5     4    #123   |
 | 7    *123   5     | 4    *123   9     | 8     16   #1236  |
 |*123   4     6     |*123   58    58    | 23    79    79    |
 |-------------------+-------------------+-------------------|
 | 6     9    *123   | 8    #123   7     | 4     15    1235  |
 |*123   5     7     | 9     4     6     | 23    8    A123   |  A => impossible pattern
 | 8    *123   4     | 5    #123  #123   | 7     69    69    |    => r2c9=6
 |-------------------+-------------------+-------------------|
 | 4     126   8     | 126   57    12    | 9     3     57    |
 | 1235  1237  1239  | 123   579   4     | 6     57    8     |
 | 35    367   39    | 36    5789  58    | 1     2     4     |
 *-----------------------------------------------------------*

It seems that, when you can use “replacement method” then have "impossible pattern" side by side. I'm not sure... :D

totuan
totuan
 
Posts: 230
Joined: 25 May 2010
Location: vietnam

Re: Eleven's variable replacement method and its complexity

Postby denis_berthier » Wed Dec 07, 2022 4:46 pm

totuan wrote:It seems that, when you can use “replacement method” then have "impossible pattern" side by side. I'm not sure... :D

You have an example where this is true.
But the method is extremely general. You can apply it to a Naked Triplet.

But the converse is true: when you have an impossible k-digit pattern (with appropriate conditions on the places of cells), you can apply k-replacement.
In any case, applying replacement is just that: applying it. It doesn't guarantee to lead to a solution.
denis_berthier
2010 Supporter
 
Posts: 3970
Joined: 19 June 2007
Location: Paris


Return to Advanced solving techniques