Subset Logic: Finding Safe Cells

Subset logic is the general principle behind the 1-1-X and 1-1 corner patterns, but it works far beyond those specific cases. Whenever one number’s unrevealed neighbors are a subset of another’s, and both numbers require the same mine count in the overlapping region, the non-overlapping cells are guaranteed safe.

This is the backbone of intermediate and advanced Minesweeper solving. It works everywhere on the board — walls, interiors, corners — and it scales to any number combination.

Also known as: H1, H2 (hidden safe patterns). In shorthand notation, “H” patterns refer to hidden deductions that require comparing overlapping constraint regions.


The General Rule

Given two numbered cells:

  • Cell A needs $m$ mines among unrevealed neighbors ${S_A}$
  • Cell B needs $n$ mines among unrevealed neighbors ${S_B}$
  • ${S_A} \subseteq {S_B}$ (A’s neighbors are a subset of B’s)

Then the non-overlapping cells ${S_B \setminus S_A}$ contain exactly $n - m$ mines.

If $n - m = 0$: All non-overlapping cells are safe. This is the “finding safe cells” case.

If $n - m > 0$: The non-overlapping cells contain mines. See Subset Logic — Finding Mines for that case.


Why It Works

The subset relationship means everything Cell A knows about its neighbors is automatically included in Cell B’s constraint. Cell A’s mine count accounts for the shared cells. Cell B’s mine count covers the same shared cells plus extras. The difference tells you exactly how many mines are in the extras.

When the mine counts are equal ($m = n$), the shared cells fully explain Cell B’s mine requirement. The extra cells must be clean.


Example: A “2” and a “2”

A “2” on the left has four unrevealed neighbors: {P, Q, R, S}. A “2” on the right has two unrevealed neighbors: {P, Q}.

The right “2” tells us: both P and Q are mines (since it needs 2 mines in 2 cells).

The left “2” also needs 2 mines in {P, Q, R, S}. Since P and Q are both mines, R and S contain zero additional mines. R and S are safe.

This is subset logic: {P, Q} ⊂ {P, Q, R, S}, mine counts 2 = 2, so {R, S} has 0 mines.


Example: A “1” and a “1” (Interior)

Two “1"s share two unrevealed neighbors. One “1” sees those two cells plus three more. Both need one mine.

The inner “1” has one mine in {A, B}. The outer “1” has one mine in {A, B, C, D, E}. Since {A, B} ⊂ {A, B, C, D, E} and both need 1 mine, {C, D, E} has $1 - 1 = 0$ mines. All three are safe.

This generalizes 1-1-X to any geometry, not just walls.


How to Spot Subset Relationships

Step 1: Find a “Tight” Number

Look for numbers with few unrevealed neighbors — these create tight constraints. Corner numbers (3 neighbors max), edge numbers (5 neighbors max), and any number almost fully satisfied by flags are good candidates.

Step 2: Find an Adjacent Number Sharing Those Neighbors

Look at numbers next to your tight number. If the tight number’s unrevealed cells are all also neighbors of the adjacent number, you have a subset.

Step 3: Compare Mine Counts

Subtract flags from both numbers to get effective mine counts. If the counts are equal, the extra cells (those only the larger set sees) are safe. If the larger set’s count is higher, those extra cells contain mines.


Subset Logic Beyond Pairs

Subset logic can chain through multiple numbers:

  1. Number A constrains a small set → establishes a mine count.
  2. Number B shares A’s set plus extra cells → determines the extra cells.
  3. The resolved extra cells then constrain Number C further.

This chaining is how Combined Logic Chains work — each subset resolution feeds into the next.


Common Mistakes

Forgetting to Subtract Flags

Before comparing mine counts, subtract any flags adjacent to each number. A “3” with two adjacent flags effectively needs 1 more mine — use the reduced count.

Assuming Subset When It Isn’t

Both cells’ unrevealed neighbors must be checked carefully. If the “tight” number has even one unrevealed neighbor that the other number doesn’t see, it’s not a proper subset.

Missing Diagonal Neighbors

Numbers count all eight neighbors including diagonals. A cell you think isn’t shared might actually be a diagonal neighbor of both numbers.