Print Version Page Index
Solvers
Puzzles
Basic Strategies
Tough Strategies
Diabolical Strategies
Extreme Strategies
Deprecated Strategies
Str8ts
Other

Order Now!
Order Now!

# Almost Locked Sets

On the occasional Diabolical and most certainly on many Extreme Sudoku puzzles there will be many opportunities to whittle down the candidates by identifying and using Almost Locked Sets. Lets think about the terms first. A set of candidates is locked if the number of candidates in a group of cells matches the number of cells they are in. For example, a Naked Pair of 3/7 on two cells is a locked set: two candidates in two cells. They are considered "locked" because we know all the candidates for the cells; we just don't know the solution order.

Any set of cells with exactly one extra candidate is "Almost Locked". The solver now uses curley {brackets} to denote them bringing them in line with AIC chain links.

Note: these examples require AICs and Forcing Chains to be unticked in the solver.

ALS is strongly related to XYZ-Wings and WXYZ-Wings which are subsets of ALS.

It's one away from being locked down. All Naked Pairs, Triples, Quads etc are Locked Sets. Formally, we are interested in groups of cells of size N with N+1 candidates.

Take this example where two Almost Locked Sets have been coloured in yellow {A3,J3} and brown {B5,J5}. You can immediately see that the first set has {4,6,8} as members and the brown set has {1,6,8}. So far so good. But since Almost Locked Sets are so common - and you will see them everywhere!, perhaps the greatest difficulty with this strategy is finding ones we can work with. The building blocks are easy enough, but spotting the formations that conform to the rules outlined below can be tricky.

## Rule 1: The Almost Locked Set XZ Rule

To make use of Almost Locked Sets, we're going to need two or more of them. Their sizes don�t matter, but they ought to be able to 'see' each other that is, have some cells that share a unit (row J in this example). We also need a mixture of candidates in both sets. If there is a common candidate found in both sets and this common candidate is among those cells that can 'see' each other, this candidate can exist only in one set or the other. We call this candidate a restricted common. In the two sets in the example above, 6 is a restricted common because 6 in one set will remove it in the other. Let's call any restricted common candidate X.

The Z part of the rule involves any other candidate found in both ALSs but not a restricted common; that, a candidate that still appears in both ALSs and is not exclusive to one or the other. In the above example, Z is number 8. Now, it so happens that any other 8 on the grid that can 'see' all the 8s in both ALSs can be removed.

Making an interesting observation is one thing, but what's the proof? Think of the 8 in A5 in the example above. If 8 were the solution, we'd quickly get a contradiction in at least one of the two sets. A3 would become 4, forcing J3 to be 6 and that removed 6 from J5. B5 would become 1 and since 6 and 8 are removed form J5 as well we are left with a 1 also in J5 - two 1s in the column. So following the consequences through shows the 8 in A5 must go.

## A 1 Cell + 3 cell Example

The N+1 definition also applies to single cells - they simply must have two candidates in them - the natural bi-value cell. This next example uses a 3-cell ALS in combination with the 1-cell ALS.

The yellow cell F1 is our first ALS. The 1 and 3 in F1 can see F4 which is part of the brown 3-cell ALS. 1 and 3 are common to both ALS but only 1 is restricted common because all the cells in both ALSs can see each other. 3 can't be restricted because the 3 in E4 cannot see the 3 in F1.

The XZ rules says we can use that 3 to look for other 3s that share units with both ALSs. The sole 3 on F5 can see F1 (row) and the 3s in E4 and F4 (because of the box). That 3 can be removed.

## More Complex Examples

Both these next examples come from the same puzzle and almost follow on from each other. The definition of example 3 is

Rule 1: [J5] and {D5|D6|E4|E6|F6}, 5 is restricted common, other common candidate 7 can be removed from F5

We have an enormous 5-cell ALS in brown with 5 as the restricted common. You can see that 5 occurs only in D5 and aligns with the yellow ALS J5. Its pretty hard to pick out a 5-cell ALS but if you add the numbers available in the brown cells you can see there are 6 possibilities. 7 is shared by both ALSs and is not restricted so it can be removed.
Still on number 7 the next step is another ALS combination, this time a 2-cell and a 4-cell. The {1,2,7} in the top yellow ALS is matched with a set of {1,2,6,7,8} in row G. 1 is linked by A2 and G2 so it is restricted common. The only interesting cell that is not part of any ALS and contains common candidates is G7. Apart from 5 it contains 2 and 7. The 7 can see the 7 in A7 and all the 7s in the brown ALS. It can be removed. 2 looks like it could be eliminated but there is a 2 in A2 which it cannot directly see. To be eliminated the X must see all the candidates X in both ALSs, which is not the case with 2.

Rule 1: {A2|A7} and {G2|G5|G6|G9}, 1 is restricted common, other common candidate 7 can be removed from G7

## ALS-XZ Rule 2

Thanks to David Bird for the extension to the ALS-XZ rule that allows other candidates to be eliminated. Docs to come

 Go back to Unit Forcing Chains Continue to Finned X-Wing

Email Address - required for confirmation (it will not be displayed here)

 Please enter theletters you see: Remember me
Email addresses are never displayed, but they are required to confirm your comments. When you enter your name and email address, you'll be sent a link to confirm your comment. Line breaks and paragraphs are automatically converted - no need to use <p> or <br> tags.

## ... by: Robert

Bugger, I did not describe my idea for an extension to this technique properly.

My proposed "Rule 2" is correct as far as it goes, but it is incomplete. If there are two restricted digits in the ALS case, or a number of restricted digits equal to the "excess" (definition in my earlier comment) if we allow AALS or even more "A"s, then all restricted digits must occur in the one set or the other. Therefore, in any cell outside the two sets, if one of the restricted digits occurs and can "see" all occurrences within the two sets, it can be eliminated. So there are two types of eliminations - restricted digits need to be able to see all occurrences in both sets, but unrestricted digits only have to see all occurrences in one of the two sets. Unrestricted digits in this case do not have to occur in both sets; however, if they do, some of them may be eliminated, if they can "see" all occurrences of the same digit in the other set.

## ... by: Robert

Follow-up to my earlier comment regarding my extension of this strategy.

In my database of 341 "advanced" puzzles, I run the ALS strategy (with my version of Rule 2, which may or may not be the same as David Bird's) together with basic techniques, and get 66 puzzles fully solved.

My extended version of the strategy only finds eliminations based on ALSs, AALSs, and AAALSs. Furthermore, although my solver does find some eliminations involving AAALSs, it finds the same eliminations when restricted to just ALSs and AALSs.

So I don't know whether there is some general wisdom here that there is no need to check for anything more than an AAALS, or if that is just a specific property of my sample of 341 puzzles.

## ... by: Robert

So the documentation on Rule 2 is still on the to-do list, but I have speculated in a comment last week about what it might be. I repeat my speculation here, and also offer an extension to this method.

First, my speculation about Rule 2 - if there are two restricted digits in the pair of ALSs, then any candidate in any cell that can see all of the same digit in just *one* of the ALSs can be eliminated. This might possibly include occurrences of that digit in the other ALS (so the same value occurring in both ALSs, but it is not restricted, and therefore possible for the same digit to appear in the solved puzzle in both ALSs). My own solver finds some instances of this occurring in my sample of "advanced" puzzles (now up to 341 puzzles), and can solve 66 of those puzzles using the basic techniques, the ALS Rule 1 above, and my proposed version of the ALS Rule 2. Using only Rule 1, I get 65 puzzles solved instead of 66, and possibly some additional eliminations in puzzles that are partially solved (I would have to check).

Rule 1 is a special case of AICs with ALSs, but with the size limitation in the implementation of ALSs that appear in AICs, it is possible that the solver might find some eliminations using this strategy, that is doesn't find using AIC with ALSs. My version of Rule 2 is also a special case of AICs with ALSs.

Now, for my extension. We can use not just ALSs, but AALSs, AAALSs, etc. So here is how it works. Find two groups of cells that are not locked sets. (If they include locked sets as subsets, these should be thrown away - the strategy is still valid, but other strategies can be applied.) So they might be ALSs, AALSs, AAALSs, or maybe even more Almosts. Call the "excess" the combined number of "almosts" in the two sets. For example, if one set is an ALS, and another is an AALS, the "excess" is three. If there are two AALSs, the "excess" is four. If there are two ALSs, the "excess" is two. (I think this strategy probably works with locked sets as well, but in that case, easier strategies can be used instead.)

The number of restricted digits (same definition used for ALSs) cannot be more than the "excess". If it is, the puzzle has no solution (or we have made a logical error while trying to solve it).

Rule 1: if the number of restricted digits is equal to the "excess", then any candidate in any cell that can "see" all occurrences of an unrestricted digit in *either* (not both) of the sets can be eliminated. This might possibly include candidates in one of the two sets, if it can see all occurrences of an unrestricted digit in the other set.

Rule 2: If the number of restricted digits is equal to the "excess" minus one, then any candidate in any cell that can "see" all occurrences of an unrestricted digit in *both* of the sets (and the unrestricted digit must occur in both sets) can be eliminated.

I have implemented this in my own solver. Once I had the ALS code running smoothly, it probably took me five minutes to make the extension (definitely less than ten). It adds a lot of processing time, because *every* set of cells within a unit that is not a locked set, is an ALS, an AALS, an AAALS, an AAAALS, an AAAAALS, an AAAAAALS, an AAAAAAALS, or an AAAAAAAALS. In my database of advanced puzzles, it does not solve any additional puzzles (when combined with basic techniques) than the 66 solved using ALS Rule 1 and my version of Rule 2 (which may or may not match David Bird's Rule 2). However, it does find some additional eliminations, bring some of the partially solved puzzles a little closer to solution.

When I combine it with all the other strategies I have implemented, although a number of my "super-ALS" pairs are found, and some eliminations made, all the same eliminations would have been made by other strategies anyway. So it is possible this extended strategy is a special case of some other strategies (just as Rule 1 of the ALS strategy, and my version of Rule 2, are special cases of AIC with ALSs).

## ... by: Robert

So no docs on the extension mentioned, but if I may speculate -

Is it that, if there are two restricted digits, then any candidate that can see all instances of a non-restricted digit in *either* (not necessarily both) ALS can be eliminated?

## ... by: Gary

Almost Locked Set Example 3: cannot 7 also be removed from D5?

## ... by: Robert

In my last comment, I put some of the content in angle brackets, which apparently made them invisible (I guess they are interpreted as formatting commands).

The missing parts simply state that the links in my AIC are weak-strong-weak-strong-weak.

## ... by: Robert

I've been implementing my own solver, really just for laughs, and I've gotten as far as AIC with Groups. Still need to do AIC with ALSs, which is next on my to-do list. But AIC seems to be an extremely powerful technique. Mesusa (except for Rule 6), Digit Forcing, Nishio Forcing, and some other strategies are all special cases.

Which brings me to this one. All of the examples above look like they could be considered examples of AICs with ALSs, if we define a weak link between certain candidates in the ALSs. In these examples, the resulting AIC has five links, and the candidate to be eliminated as between two weak links. If this candidate is "on", then the same candidate must be "off" in both the ALSs. But because they are ALSs, if one of the candidates is "off", all the other candidates must be "on" (strong link), although if a candidate appears several times within the ALS, we won't know which one is "on". But for the restricted common, there is a weak link between the two ALSs - "on" in one means "off" in the other. So we have an AIC. In the last example shown,

Candidate 7 in G7

Candidate 7 in ALS {G2,G5,G6}

Candidate 1 in ALS {G2,G5,G6}

Candidate 1 in ALS {A2,A7}

Candidate 7 in ALS {A2,A7}

Candidate 7 in G7

So it is an AIC, Candidate 7 in G7 can be eliminated by Rule 3 (and Rule 1 and Rule 2 are really just special cases of Rule 3 anyway).

So I think by defining the notion of a "weak link" between ALSs (which is done using the restricted common), we could build more complex inference chains than the five-step ones shown above.

Whether this is computationally feasible, let alone human-feasible, I do not know at this point.

## ... by: Cerberus

Where are the docs you often refer to?
I was looking at the Almost Locked Sets web page, at the bottom you have a title, ALS-XZ Rule 2, with a thanks to Davis Bird and that Docs were to come. Where can they be found, or do they not exist yet?

Andrew Stuart writes:

Yeaahhhh, looks like that fell by the wayside. I will add it to the job queue!

## Friday 2-May-2014

I have found it quite useful to extend this method with XY-Chains. XY-Chains find weak links between bi-value cells but you can use ALSs in place of XY cells (XY cells are just a simple type of ALS).

ALS XZs are just a two step chain and a "ALS Chain" is just continuing this logic.

These may seem hard to find at first, but if you are already looking for XY-Chains I have found it quite easy to include 2 and 3 cell ALSs in the chaining logic.

Of course all of these are examples of AICs but I find those to be quite hard to find in general.

## ... by: ralph maier

LOL
Still interested to know whether a restricted candidate is really necessary for an ALS to work

## ... by: sunshine48

A simple explanation, I finally got it. Wonderful site.

## ... by: Douglas Boffey

There is a second way a set can be almost locked, namely, when N candidates appear in N + 1 cells within a unit. I call this a Hidden ALS (or HALS), as knocking out one of the cells reduces to a hidden pair/triple/quad/&c. Likewise, the ALS described on this page would be better called a NALS (Naked ALS).

## ... by: Tokgot

I wish to show my appreciation to the witrer just for bailing me out of this particular issue. Just after browsing throughout the world-wide-web and coming across opinions which were not productive, I was thinking my life was gone. Being alive without the solutions to the problems you've resolved all through your entire report is a critical case, as well as ones that might have in a wrong way damaged my entire career if I had not discovered your web site. Your main expertise and kindness in handling all the pieces was very useful. I am not sure what I would have done if I hadn't come upon such a thing like this. I can now look forward to my future. Thanks so much for your high quality and amazing guide. I won't think twice to recommend your blog to any person who wants and needs assistance on this issue.

## ... by: Jason

Ian,

If I understand correctly, adding G5 to the brown ALS does no good. You can only use this technique to make eliminations on numbers common to both the ALS.

In Example 1, adding G5 to the brown ALS picks up another candidate, the 9, but it will not lead to any more eliminations because the yellow ALS does not have a 9. If the yellow ALS happened to have a 9, then it could help.

Essentially, the relationships between the common elements of the two ALS means that the unrestricted common candidate (in Example 1, it's the 8) has to be the correct solution for a cell in at least one of the two ALS. So at least one of the yellow or brown cells that contain 8 as a candidate must actually be a 8 in the final answer.

It logically follows that 8 can be removed as a candidate in any cell that can see ALL of the 8s in the yellow and brown squares.

## ... by: Ian Saliba-Curtis

Hi Andrew!
Example 1: Could you not also have added G5 to the brown ALS and made it an almost locked triplet over 4 candidates?

If yes - is there a reason why you didn't?
If no - please could you explain why not?

Many thanks! Your site is fascinating.
Kind regards,
Ian

## ... by: Marc

Ok, I've found out the answers myself...

Answer 1 = No, it's not true. A bi-value cell ALS can share the same box with one or more cells of the other ALS

## ... by: Marc

I have two questions:

If one of the ALS is a bi-value cell, then the other ALS cannot have a cell in the same box of the bi-value cell, is that true?

If none of the ALS is a bi-value cell, and they both are in a row (or both in a column), can both these rows (or columns) appear in the same band (or stack)?

## ... by: rlhaben

Actually, sorry. I was wrong on this one. It does present a contradiction. I stared at this for 15 minutes trying to see it. Wrote the comment, then looked again and saw it immediately. Looking forward to getting this on the iPad. :)

## ... by: rlhaben

Andrew must be busy on the mobile solver since I have seen no answer. But I think Grandad is right. If you load the example, you will not even get to ALS as an example for those cells unless you manually remove the 2. However, even in that case, the proof doesn't seem to work. If you make F5 a 3, it does not present a contradiction in the two ALSs. It may present a contradiction elsewhere. But this type of example trips me up. I bought the book and I love it. But I often find that I can't prove a path I follow using its rules. I usually import the puzzle that I can't prove and watch what the solver does. Sometimes that helps, sometimes not.

## Tuesday 23-Aug-2011

I am almost certainly not the first to ask but - in the 2nd example, surely F1 should have possibles 1, 2 and 3 so isn't an ALS ?

## ... by: Terry

Hi Andrew,

Excellent site ;-)
I'm just getting to grips with some of the more difficult strategies. I had a puzzle loaded in the solver and it came up with an ALS that I fail to understand :( The starting point for the puzzle is

..7...32.1..2.7..6.26.5.71..8...2....19.6.5...6.7......91.2..475..17.....78......

If you just keep clicking 'Take Step' until it comes to the first ALS, I can't see how 8 is restricted as 6 can also be seen by both ALSs.

What am I missing in my understanding of the ALS technique?

Many thanks and best wishes,

Terry

## ... by: Ana

In the last example the {1,2,6,7,8} in row G is not an ALS because it has 5 candidates in 3 cells
Andrew Stuart writes:

The four cells highlighted in brown are the ALS, so thats 5 candidates in 4 cells.

Article created on 12-April-2008. Views: 136171