Unofficial Hacker News companion — get notified on comment replies, and more.

Sudoku's Hidden Rule (opens external site)

478 points by multifasciatus 1 day ago | cyrusjavan.com | 213 comments on HN | Vote on HN (opens Hacker News) |

View full thread · View on Hacker News

Comment thread (55)

  1. I love sudoku, especially variant sudoku, and for years I've had a daily habit of solving puzzles through the Cracking the Cryptic apps.

    I really dislike using uniqueness. Not because it feels like cheating. Every time it becomes relevant it just feels inelegant. I love spotting a swordfish, Y-wing or empty rectangle. But uniqueness feels lazy and anticlimactic. In all other cases I simply find using every advantage to reason about the puzzle and deriving constraints exhilarating. But uniqueness somehow feels like it's not about the structure of the puzzle. It gives me the same feeling as bifurcation. There I can clearly tell why I dislike it: it usually feels like brute force rather than elegant logic. Not sure why I feel similarly about uniqueness.

    I remember in one of the Cracking the Cryptic videos Simon said he was sure uniqueness wasn't required for the current puzzle because a setter of this caliber wouldn't design a puzzle to rely on it. Which is why I was really surprised to find that one of the puzzles in the Classic Sudoku app from CTC used uniqueness this way.

    Replies (12)
    1. Uniqueness feels like the thing I'm trying to prove. On a meta level I understand that the puzzle in front of me has exactly one solution, because it wouldn't be satisfying if it had multiple or none. But unless it's explicitly stated in the puzzle rules, I'd rather not use it. The goal isn't just to find a solution, but to find it using strict deductions, so that your steps of reasoning become like a proof that this is the unique solution.
      Replies (3)
      1. Yes, that is precisely it! It feels like a circular proof. You assuming what you haven't proven yet. It feels unearned.
        Replies (3)
        1. gently disagree. uniqueness is one of the axioms of a Sudoku, you don't prove it, you rely on it.
          Replies (2)
          1. It's an axiom of a valid, solvable (that is to say, well-constructed) Sudoku. You technically do not know this to be true. At best you are assuming the Sudoku is well-constructed based on the reputation of the source

            If you do not rely on uniqueness you can check the other trivial constraints (nine rows, nine columns, etc), solve the sudoku, and then you know that it was well-constructed. If you use the property that it is well-constructed to solve it, your solution no longer showed that the Sudoku is well-constructed

          2. I don't disagree that puzzles can be designed with that axiom as a critical tool in reaching solutions - I just vastly prefer puzzles that do not require either of the techniques outlined to reach the solution. This is entirely a matter of personal preference though, I don't reject Sudokus that have deadly rectangle traps in them as invalid - I just don't enjoy needing to rely on them since they, I suppose, break my immersion that I'm solving a problem instead of playing a game.

            Many problems in the real world have zero or many solutions, it feels artificial to me to leverage the fact that there must be a single valid solution to reach a solution.

        2. The perhaps obvious question: is it actually possible to design a sudoku with multiple solutions, BUT if people use BUG, they will get stuck and not get a solution at all?

          If such a thing is not possible, the reasoning is not actually circular.

          Replies (2)
          1. It is possible. Imagine a sudoku with just one number filled in at the start. Clearly there could be multiple solutions.
            Replies (1)
            1. But there is a second constraint. If someone were to use BUG, would they be unable to find any solution at all? For the one-number-at-the-start, BUG doesn't (obviously) lead to deadlocks later.
          2. Counterexample: the case from the blog post could be filled in like so:

                8 5 7 |   6   |     2
                  4   | 2 8 7 |     5
                  2   |   5   | 8   7
                ------+-------+------
                1 7 4 | 5 2 3 | 6 8 9
                2 8 5 | 4 9 6 | 3 7 1
                3 9 6 | 7 1 8 | 5 2 4
                ------+-------+------
                4 1 2 | 6 3 5 | 7 9 8
                5 3 8 | 9 7 2 | 4 1 6
                7 6 9 | 8 4 1 | 2 5 3
            
            If you fill in a 3 where the blog post tells you then you get a contradiction, 0 solutions. But the puzzle as it stands has two.

            You are correct to suspect that there's an impossibility result here but it requires a stronger logical model than Sudoku can provide or something. (The theorem is called Löb’s theorem, and says that if a logic can prove “if P is provable, then P is true” then it can prove P, as long as it was sophisticated enough to start with.)

        3. I think there is truth to this. I think it is possible that a Sudoku puzzle does not have a unique solution, but using the deduction methods explained in the article will lead to only one of those solutions.

          For example, consider the following situation:

          2,3 - 2,3

          1,2,3 - 2,3 - 1,3

          1,2,3 - X - 1,3

          Then

          2 - 3

          3 - 2 - 1

          1 - X - 3

          and

          2 - 3

          1 - 2 - 3

          3 - X - 1

          are both possible solutions, but applying the unique rectangles deduction in the article would only lead us to the second solution.

          Replies (1)
          1. There's actually a third solution, made by swapping the 2s and 3s of your first solution:

            3-2

            2-3-1

            1-X-3

            This solution looks identical to the first one from the perspective of the rest of the puzzle. Nothing can force a single solution. Since sudoku designers/publishers have an unwritten rule that solutions are unique, one can assume that neither of those are the solution. Something somewhere else in the puzzle will force the 1s to be placed in order to create your second solution.

      2. Why wouldn't it be satisfying if it had multiple solutions?
        Replies (2)
        1. Because you will not solve it by filling in all spots, but instead by reducing it until you spot the "deadly patterns" that admit multiple solutions.
          Replies (1)
          1. And then you pick a number and fill out a solution? These aren't deadly, which to me implies no solution. You have a free choice. Consider this crossword puzzle, for example: https://x.com/matttomic/status/1490690612672315398
            Replies (1)
            1. That's not what riddles are about though. There ought to be freedom regarding how to arrive at the solution, not what the solution is. The latter is what real life is about, but the point of doing riddles is in part to escape from real life :)

              Continue this thread (1 replies) →

        2. Would a Poirot novel be satisfying if at the end, the detective concluded that suspect A was guilty, but he couldn't rule out that some other suspect was equally guilty?
          Replies (5)
          1. Would a Nolan movie be satisfying if at the end, there is a concrete conclusion to the story?
            Replies (3)
            1. An excellent question. It invites conjecture, but we may never know for sure.
            2. I liked his Batman series just fine.
            3. Pretty sure every Nolan movie has a concrete conclusion. Ambiguity isn't the same as a lack of resolution. Memento and Tenet have definitive endings, they're just not immediately obvious. Even Inception gives you enough clues to figure out the ending if you're paying attention to something other than the spinning top.
          2. I can think of, at least, one Poirot novel that had multiple solutions
          3. In a murder story there can only be one murderer (except in Murder on the Orient Express..), because it is a question about history.

            This is a number puzzle.

            Replies (1)
            1. Let's not give away the ending of the Orient Express. It's a humdinger of a mystery.
          4. Would The Martian be unsatisfying of the astronaut found two ways to survive?
            Replies (1)
            1. Yes.

              "There are seemingly no ways to survive, the protagonist still finds one" is a satisfying narrative.

              "There are two potential ways to survive, but one of them has to be fake, the protagonist chooses one to the best of his ability, but we don't learn until later if he's right" is a satisfying narrative.

              "There are two potential ways to survive, both are perfectly good, the protagonist chooses one of them and the story never comes back to this choice" is a waste of pages.

              Continue this thread (1 replies) →

          5. Multiple solutions to mystery novels was the entire conceit of the Choose Your Own Adventure series.
            Replies (1)
            1. Not the ones I remember. It was more “choose correctly to not die” multiple times, and the correct choice was not always apparent.

              I can’t remember any story where it was a mystery with multiple possible outcomes, but they wrote a ton of those books so it is possible.

              Continue this thread (2 replies) →

      3. it wouldn't be satisfying if it had multiple or none

        I think it's satisfying when a puzzle subverts expectations. This is something that only works once in a blue moon though.

    2. > I really dislike using uniqueness.

      I dislike uniqueness so much I refuse to use unique numbers in rows, columns or blocks. It's a complete grid of ones for me.

    3. I feel uniqueness is like solving physics puzzle by analyzing energy instead of analyzing how the state changes from moment to moment using calculus. It's delightful.
    4. You never have to use uniqueness -- although it can often make a deduction easier. In some puzzles, particularly ones involving drawing lines and cycles, I find it can be hard to ignore uniqueness, because it's easy to come up with 'this part of the puzzle can't look like X, because it could also look like Y'.
      Replies (1)
      1. (I don’t know anything about Sudoku so sorry if this is a dumb question).

        Could a Sudoku puzzle be designed such that you do have to use uniqueness? Is “you never have to use uniqueness” a statement about the rules of the puzzle, or an observation about how people tend to design them?

        Replies (3)
        1. Yes, I have seen a handful of very interesting puzzles where the setter explicitly intends for uniqueness to be used in solving. It can be satisfying in that context.
        2. It's a logical statement, given a Sudoku grid, I can enumerate all solutions using a backtracking solver and count the solutions.

          Now, in practice people don't solve which backtracking, they use increasingly clever logical reasoning steps. You can technically solve any problem with sufficiently clever reasoning steps (because you could in principle capture in your brain 'if I consider all options this is the solution), in practice people have a limit, and this varies from player to player.

          So you could have a Sudoku which can be solved with uniqueness, and which no human player can solve without using uniqueness, but I haven't seen one.

          ( Random comment for interested parties, this is literally my area of research: https://github.com/stacs-cp/demystify-rs )

        3. I imagine it's possible to do on a "plain" sudoku, though I've never encountered it, but there are definitely variant sudokus where it's necessary to rely on uniqueness. eg. https://www.youtube.com/watch?v=tDNr_ZVPJNU
    5. Non-uniqueness is one of the things I don't like about Pips from nytimes. Sometimes there are multiple solutions to a puzzle! I otherwise love and enjoy solving these, but when you can flip a domino around and get another possible answer, I find it distasteful.
      Replies (1)
      1. I completely agree. It's really unsatisfying to try to figure out how to place a tile, only to find out it doesn't matter.

        It also means just trying something is often faster than thinking about the right move when you're stuck. That just feels wrong.

        Replies (1)
        1. Yes exactly! I am not sure if adding uniqueness takes anything away from the game, haven’t thought it through so much. It may be that only some types of hard puzzles can work with it, but I can’t say which for certain. Overall, bleh!
    6. You have to think of the solution set. A quadratic equation has 0 or 1 or 2 solutions which form a single solution set. No one complains about quadratic equations.

      Accordingly, all sudokus have a single valid solution set. I have no problem with that.

      Replies (2)
      1. Pedantically, all quadratic equations have two solutions. In some the two may be identical and in others they may be complex.
        Replies (1)
        1. Pedantically, multiple roots are not separate solutions, and whether a solution exists can depend on your choice of ring.
      2. Sure, but it's trivial to see why 1 is the preferred state for a game. The easiest way is probably the reductio ad absurdum of imagining a blank sudoku board with no numbers as your starting point. There are approximately 6.67 x 10 ^ 21 solutions... all you have to do is find one! Isn't this fun?
    7. someone once devised a puzzle that could only be reasonably solved using uniqueness. I tried to find the video of mark solving it but failed; I think the setter did hint that uniqueness was needed rather than mark figuring it out from a cold start.
    8. I play on my iPhone, and I find that the sudokupad mobile app is... not the best. So I made my own that can play most (see below) sudokupad puzzles, and also pulls in the CTC video feed and finds the associated puzzles.

      Unfortunately, I probably can't share it with anyone because of how it was made and how it works, but it's definitely made it easier for me to play some great puzzles.

      I also dislike uniqueness as a rule, and I think the CTC hosts have expressed on several occasions that they'll generally refuse to use it unless the puzzle is truly otherwise unsolvable. I think they're a bit more tolerant of bifurcation, but only if the contradiction emerges quickly, and double bifurcation isn't nice. I get the impression that bifurcation is used more in competitive play because it can sometimes be faster than trying to spot something the "intended" way.

      ---

      My app can't play all the puzzles, because some of them have unusually large grids that have impossibly small tap targets on phones. But otherwise, any puzzles that don't work are just down to bugs on my end.

    9. By the way, I avoid pencil marking at all because that feels like cheating.

      I'm curious if anyone else solves their sudoku without pencil marking?

      Replies (2)
      1. I try to do them in my head, but for the hardest ones some scribbles are almost necessary (for me).
      2. I don't think of it as cheating, I think of it as a different experience.

        I started without pencil marking (because I didn't know enough to know it could help), then added pencil marking, and eventually stopped pencil marking for the most part. But that means I won't be able to solve some puzzles. So I'll sometimes decide to use pencil marking just to have a different experience, though not often; I don't find it to be as fun.

        Forgoing pencil marking means I have to be willing to re-derive options repeatedly when I can't remember them, and makes for much more of a mental workout and an active experience. With pencil marking, it becomes a mostly mechanical process: good for passing time, but with less of a payoff at the end.

    10. I wonder if that's connected to the conversation you're having with the setter?

      As in, for a great puzzle the setter laid out one or two paths for the solver, and part of the solve is teasing out that plan the setter had in mind. Or, also fun, finding a way through that maybe the setter didn't anticipate.

      With that in mind, you know that uniqueness wasn't in the setter's plan, and so using it becomes a bit rude let's say, since you're opting out of that conversation.

    11. There was one puzzle they did where uniqueness was specifically called out as being necessary for the puzzle in the instructions, and it exploited it in a few interesting ways, and I thought that was a great puzzle, but mostly I think it is a sign of poor puzzle design, and it is usually only accidentally exploitable as a side method to solving it and not the intended path.

      edit: someone else posted it in another comment: https://sudokupad.app/dwa3x2ld09

    12. I'm not much of a sudoku player, so maybe mistaken here, but is uniqueness even much of a shortcut?

      It seems like, at least in the example, there is not much gained. You could reason conditionally, if this puzzle has uniqueness then the 123 is a 1 and the rest falls into place fairly easily, or it's not unique then everything still falls into place fairly easily (with less constraint).

      And so you just look at it with a 1 in that place and see if everything drops out of it, and if not you write down one of the non-unique solutions.

      Maybe this is only if this comes up at the end of a puzzle, rather than early on?