get_equality_from_cycle_cnf([Id1,Id2], PosEqNodeTriple, NegEqNodeTriple, EqCNF) :-
% the new SAT variable eq is equivalent to the equality of Id1 & Id2
% note that non unit clauses might be referenced to ids which requires some rewriting
disjunct_ids_to_cnf(Id1, not(Id2), TCNF1),
maplist(append([NegEqNodeTriple]), TCNF1, CNF1),
disjunct_ids_to_cnf(not(Id1), Id2, TCNF2),
maplist(append([NegEqNodeTriple]), TCNF2, CNF2),
append(CNF1, CNF2, CNFLhsImpl),
disjunct_ids_to_cnf(not(Id1), not(Id2), TCNF3),
maplist(append([PosEqNodeTriple]), TCNF3, CNF3),
disjunct_ids_to_cnf(Id1, Id2, TCNF4),
maplist(append([PosEqNodeTriple]), TCNF4, CNF4),
append(CNF3, CNF4, CNFRhsImpl),
append(CNFLhsImpl, CNFRhsImpl, EqCNF). % TO DO: falsity of eq
get_equality_from_cycle_cnf([Id1,Id2,Id3], PosEqNodeTriple, NegEqNodeTriple, EqCNF) :-
% the new SAT variable eq is equivalent to the equality of Id1 & Id2 & Id3
disjunct_ids_to_cnf(not(Id1), Id3, TCNF1),
maplist(append([NegEqNodeTriple]), TCNF1, CNF1),
disjunct_ids_to_cnf(Id1, not(Id2), TCNF2),
maplist(append([NegEqNodeTriple]), TCNF2, CNF2),
disjunct_ids_to_cnf(Id2, not(Id3), TCNF3),
maplist(append([NegEqNodeTriple]), TCNF3, CNF3),
append([CNF1,CNF2,CNF3], CNFLhsImpl),
disjunct_ids_to_cnf(not(Id1), not(Id2), TCNF4),
maplist(append([PosEqNodeTriple]), TCNF4, TTCNF4),
get_clause_from_node_id_atom(Id3, Clause3),
negate_clause_to_conj(Clause3, NegConj3),
append(TTCNF4, NegConj3, CNF4),
disjunct_ids_to_cnf(Id1, Id2, TCNF5),
maplist(append([PosEqNodeTriple]), TCNF5, TTCNF5),
maplist(append(Clause3), TTCNF5, CNF5),
append(CNF4, CNF5, CNFRhsImpl),
append(CNFLhsImpl, CNFRhsImpl, EqCNF).