can_be_further_decomposed_aux(conjunct(A,B),_,positive,A,B).
can_be_further_decomposed_aux(disjunct(A,B),_,negative,A,B).
can_be_further_decomposed_aux(disjunct(A,B),_,positive,D1,D2) :-
get_preference(unsat_core_algorithm,linear_greedy_decompose),!, % can blow up number of cases
(can_be_further_decomposed(A,positive,A1,A2) % here we could try divide conjuncts in middle
-> disjunct_predicates([A1,B],D1),
disjunct_predicates([A2,B],D2)
; can_be_further_decomposed(B,positive,B1,B2)
-> disjunct_predicates([A,B1],D1),
disjunct_predicates([A,B2],D2)
).
can_be_further_decomposed_aux(implication(A,B),_,positive,I1,I2) :-
(can_be_further_decomposed(B,positive,B1,B2) % A=>B1&B2 <--> A=>B1 & A=>B2
-> create_implication(A,B1,I1),
create_implication(A,B2,I2)
; can_be_further_decomposed(A,negative,A1,A2) % (A1 or A2) => B <--> A1 => B & A2 => B
-> create_implication(A1,B,I1),
create_implication(A2,B,I2)).
can_be_further_decomposed_aux(implication(A,B),_,negative,NA,B) :- % A=>B <--> not(A) or B
create_negation(A,NA).
can_be_further_decomposed_aux(negation(D),_,NegPos,NA,NB) :- neg_context(NegPos,PosNeg),
can_be_further_decomposed(D,PosNeg,A,B), % not(A &/or B) <--> not(A) or/& not(B)
create_negation(A,NA),
create_negation(B,NB).
can_be_further_decomposed_aux(let_predicate(V,E,P),Info,NegPos,LEA,LEB) :-
can_be_further_decomposed(P,NegPos,A,B),
LEA = b(let_predicate(V,E,A),pred,Info), % used_ids could be wrong; TO DO: think about exists
LEB = b(let_predicate(V,E,B),pred,Info).
can_be_further_decomposed_aux(lazy_let_pred(V,E,P),Info,NegPos,LEA,LEB) :-
can_be_further_decomposed(P,NegPos,A,B),
LEA = b(lazy_let_pred(V,E,A),pred,Info),
LEB = b(lazy_let_pred(V,E,B),pred,Info).