instantiate_paras_by_membership([TID], LHS, _, _, Options, [Id], ScopeIds, ListOfValues, RestLHS) :-
get_texpr_id(TID, Id),
( get_texpr_id(TID2, Id),
is_membership_or_equality(MEM, TID2, Set),
select_member_in_conjunction(MEM, LHS, TRestLHS)
; get_texpr_type(TID, Type),
finite_base_type(Type, Set),
TRestLHS = LHS
),
rewrite_set_to_list_of_asts(Set, [Id|ScopeIds], Options, TListOfValues),
!,
ListOfValues = TListOfValues,
RestLHS = TRestLHS.
instantiate_paras_by_membership([TID1,TID2], LHS, _Kind, _, Options, [Id1,Id2], ScopeIds, ListOfPairs, RestLHS) :-
get_texpr_id(TID1, Id1),
get_texpr_id(TID2, Id2),
Couple = b(couple(A,B),_,_), get_texpr_id(A,Id1), get_texpr_id(B,Id2),
MEM = b(member(Couple,Set),pred,_),
select_member_in_conjunction(MEM, LHS, RestLHS),
rewrite_set_to_list_of_asts(Set, [Id1,Id2|ScopeIds], Options, ListOfValues),
maplist(convert_to_couple, ListOfValues, ListOfPairs),
!.
instantiate_paras_by_membership(TIDS, LHS, _, _, Options, IdNames, ScopeIds, ListOfTuples, RestLHS) :-
% !(x1,..xn).(x1:S1 & .. & xn:Sn & RestLHS => BODY) | #(x1,..xn).(x1:S1 & .. & xn:Sn & RestLHS)
instantiate_paras_possible_nary_member(TIDS, LHS, IdNames, [], ScopeIds, Options, TListOfTuples, TRestLHS),
!,
ListOfTuples = TListOfTuples,
RestLHS = TRestLHS.