http://www.perlmonks.org?node_id=600418

hv has asked for the wisdom of the Perl Monks concerning the following question:

Update: this is now solved, see Re^2: decomposing binary matrices (2).

Given a set of variables and a set of values, with the property that each variable has a distinct value, we can get a matrix of booleans summarising the possibilities (such that a value of 1 means "possible", 0 means "not possible"):
ABCDE
100110
210111
301010
411001
501110

With those constraints, we can derive additional information: since A and E are restricted to only two values between them, they must consume those two values; effectively we can split the above matrix into two smaller matrices:
AE
211
411
BCD
1011
3101
5111

While this is relatively easy to do by eye with a small grid, I'm looking for an efficient algorithm to find such decompositions for larger grids, for both the case as in the example above where the number of variables is the same as the number of values, and for the case where there are more values than variables (so not all the values are used).

I'm not sure quite where to start looking, so suggestions for useful search terms would also be appreciated - I suspect that I should be treating the '1's in the matrix as edges in a graph, but quite what I'm looking for in the resulting graph I've not been able to characterise.

Hugo