balance_substitutions3(assign(L,R),_,assign(L,R)).
balance_substitutions3(becomes_element_of(L,R),_,becomes_element_of(L,R)).
balance_substitutions3(parallel(Ss),Locals,parallel(Ns)) :-
balance_substitutions_l(Ss,Locals,Ns).
balance_substitutions3(any(Ids,P,S),Locals,any(Ids,P,N)) :-
balance_substitutions2(S,Locals,N).
balance_substitutions3(precondition(Cond,Subst),Locals,precondition(Cond,BSubst)) :-
balance_substitutions2(Subst,Locals,BSubst).
balance_substitutions3(select([When]),Locals,select([BWhen])) :-
balance_substitutions2(When,Locals,BWhen).
balance_substitutions3(select_when(P,S),Locals,select_when(P,B)) :-
balance_substitutions2(S,Locals,B).
balance_substitutions3(if(IfList),Locals,if(NewIfList)) :-
create_texpr(if(IfList),subst,[],TExpr),
btypechecker:get_accessed_vars(TExpr,Locals,Modifies,_),
balance_iflist(IfList,Locals,Modifies,NewIfList1),
( has_else(IfList) -> NewIfList1 = NewIfList
; otherwise ->
append(NewIfList1,[Else],NewIfList),
create_else(Modifies,Else)).