power_set(Set, Power_Of_Set) :-
    Power_Of_Set = [Set|_],
    power_set_case(Set, Power_Of_Set).

power_set_case([], [[]]).				% Step 1.
power_set_case([Elt|Rest], Power_Of_Set) :-		% Step 2.
    power_set(Rest, Power_Of_Rest),			% Step 2.1.
    power_set_augment(Power_Of_Rest, Elt, Power_Of_Set, Power_Of_Rest). % 2.2.

power_set_augment([], _, Power, Power).
power_set_augment([Subset|Subsets], Elt, [[Elt|Subset]|Power0], Power) :-
    power_set_augment(Subsets, Elt, Power0, Power).


/*
?- power_set(X, [[1,2],[1],[2],[]]).
X = [1, 2]
?- power_set(X, [[1,2],[2],[1],[]]).
no
?- power_set([1,2,3], X).
X = [[1, 2, 3], [1, 2], [1, 3], [1], [2, 3], [2], [3], []]
*/
