Do at least one of the following problems. Your choice which to do.
(1) Write a logic program that defines the binary relation powerset, where the first argument is a set and the second argument is its power set (i.e. the set of all of its subsets). You can assume that the elements of the "input" are object constants (e.g. a, b, c, and so forth) and that the "input" is a list with no duplicates (e.g. [a,b]). Your "output" should be a list of the subsets of the "input" (e.g. [[],[a],[b],[a,b]]). Your program should succeed on all queries in which the first argument to powerset is a ground set in list notation and the second argument is a variable.
(2) Write a logic program that defines the binary relation permutations, where the first argument is a list and the second argument is a list of its permutations. You can assume that the elements of the "input" are object constants (e.g. a, b, c, and so forth) and that the "input" is a list with no duplicates (e.g. [a,b]). Your output should be a list of permutations (e.g. [[a,b],[b,a]]). Your program should succeed on all queries in which the first argument to permutations is a ground set in list notation and the second argument is a variable.
