perlquestion hv <p><b>Update</b>: this is now solved, see [id://602460].</p> <p>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"): <table border=1> <tr><th><th>A<th>B<th>C<th>D<th>E</tr> <tr><th>1<td>0<td>0<td>1<td>1<td>0</tr> <tr><th>2<td>1<td>0<td>1<td>1<td>1</tr> <tr><th>3<td>0<td>1<td>0<td>1<td>0</tr> <tr><th>4<td>1<td>1<td>0<td>0<td>1</tr> <tr><th>5<td>0<td>1<td>1<td>1<td>0</tr> </table> </p> <p>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: <table><tr> <td><table border=1> <tr><th><th>A<th>E</tr> <tr><th>2<td>1<td>1</tr> <tr><th>4<td>1<td>1</tr> </table> <td><table border=1> <tr><th><th>B<th>C<th>D</tr> <tr><th>1<td>0<td>1<td>1</tr> <tr><th>3<td>1<td>0<td>1</tr> <tr><th>5<td>1<td>1<td>1</tr> </table></tr></table> </p> <p>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).</p> <p>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.</p> <p>Hugo</p>