How can I programatically resolve this type of system :
A = !B
B = !C
D = !B
E = !A
E = !B
so I can get by substituting A = C = D (3) and E = B (2). I only need the number of the 2 groups. If it’s not possible to get 2 groups, I display an error message.
In case, this is not closed as a dupe, from my answer in your previous question:
To solve equations of the form
Form a graph with nodes as Xi and connecting Xi and X j iff the equation Xi = NOT X j appears.
Now try to 2-colour the graph using Breadth First Search.