ctgDown_aux2(S,Q,Depth,CTGs,I,K,FramesIn,FramesOut) :-
% max ctgs currently 3 - needs experiments
CTGs < 3, I > 0,
% Init => not S
get_initial_state_predicate(Init),
conjunct_predicates([Init,S],IAndS),
solve(IAndS,ResultIAndS),
ResultIAndS = contradiction_found(_), !,
% F_i-1 & not S & T => not s'
create_negation(S,NegS),
prime_predicate(S,SPrimed),
IMinus1 is I - 1,
in_solver_on_level(IMinus1,FramesIn,F_I),
conjunct_predicates([NegS,SPrimed|F_I],Consecution),
solve(Consecution,ResultConsecution),
ResultConsecution = contradiction_found(_), !,
% we found a new counterexample to generalization
NCTGs is CTGs + 1,
% TODO: for loop to find J
create_negation(SPrimed,NegSPrimed),
ctgDown_aux_find_level(I,K,NegS,NegSPrimed,FramesIn,J),
JMinus1 is J - 1,
Depth2 is Depth + 1,
conjunction_to_list(S,SList),
ctgDown(SList,[],Depth2,JMinus1,K,FramesIn,FramesT,SOut),
% add modified not s to frames on level J and recur (while loop in paper)
% instead of adding not s, we add the former conjuncts and use them as disjuncts
add_clauses_to_level(J,FramesT,SOut,FramesTT),
ctgDown_aux(Q,Depth,NCTGs,I,FramesTT,FramesOut).
ctgDown_aux2(S,Q,Depth,_CTGs,I,K,FramesIn,FramesOut) :-
% the else branch
common_literals(Q,S,NewQ),
ctgDown_aux(NewQ,Depth,I,K,FramesIn,FramesOut).