# AND and OR rules

The AND and OR rules are deduction rules that can be used to build virtual connections and semi-connections. They often make it possible to compute whether two distant groups are connected. These rules were published by Vadim Anshelevich in 2000 and 2002, see the references below. Anshelevich used these rules in his program Hexy.

## Connections and semi-connections

The AND and OR rules are formulated from the viewpoint of one player. In this article, we take Red's point of view, although analogous rules can of course also be applied to Blue.

Consider two cells x and y and a set E of cells containing neither x nor y. Each of the cells x and y may either be empty or occupied by Red. We say that E is a virtual connection between x and y if Red has a second player strategy in the region E that results in x and y being connected. We say that E is a semi-connection if Red has a first-player strategy in E that results in x and y being connected. We say that x and y are the endpoints of the connection and E is its carrier.

In other words, a virtual connection is a connection that Red can guarantee even if Blue goes first, whereas a semi-connection is a connection that Red can guarantee if Red goes first. Red can turn any semi-connection into a virtual connection by placing one more stone in it. Conversely, any move by Blue in a Red virtual connection results in at least a semi-connection.

Here are some examples of virtual connections between x and y:

And here are some examples of semi-connections:

Schematically, we will represent a virtual connection by a red box, and a semi-connection by a white box, like this:

## AND rule

The AND rule is concerned with what happens when a connection E₁ from x to y and a connection E₂ from y to z are joined together "in sequence". Here, we assume that the two connections have disjoint carriers, or more precisely, that they do not have any empty cells in common.

The AND rule states that the connection from x to z is:

• A virtual connection if E₁ and E₂ are virtual connections and y is occupied by Red.
• A semi-connection if E₁ and E₂ are virtual connections and y is empty.
• A semi-connection if one of E₁ and E₂ is a virtual connection, the other a semi-connection, and y is red.

In pictures:

## OR rule

The OR rule is concerned with what happens when two or more connections from x to y are joined together "in parallel". Here we do not assume that the carriers are pairwise disjoint, i.e., some of the carriers may overlap.

The OR rule states that if each of E₁, ..., Eₙ is a semi-connection from x to y, and if there is no empty cell that is common to all of their carriers, then their union forms a virtual connection from x to y.

In pictures:

## Application of the rules

The rules can be applied repeatedly. The simplest kind of virtual connection is when two cells are directly next to each other.

By the AND rule, we get a semi-connection from x to z:

AND
=

Combining this with another semi-connection, we get a virtual connection from x to z by the OR rule:

OR
=

By the AND rule, we get a semi-connection from a to z:

AND
=

Combining this with another semi-connection by the OR rule, we get a virtual connection from a to z:

OR
=

Continuing in this manner, very large virtual connections can be constructed.

## Incompleteness

The AND and OR rules are not complete. Specifically, there are some virtual (or semi-) connections that cannot be proven to be virtual (or semi-) connections by the AND and OR rules from smaller connections. Perhaps the simplest example is the following:

It is a semi-connection (Red makes the connection by playing at a and b, in either order). However, it cannot be proven to be a semi-connection by the AND and OR rules.

Anshelevich gave a generalization of the AND and OR rules that is complete. However, that generalization requires the computation of handicap sets (sets of cells) and is computationally harder.

## Use in computer Hex

The AND and OR rules have been used in some computer Hex programs to search for virtual connections. Notably, they were used in Anshelevich's Hexy.