10-21-2014

advertisement
C241 PLTL SESSION –
10/21/2014
Exploring SETL further
Warm-Up Exercise
• Grab a worksheet
• Begin completing the worksheet in pairs or small groups
Problem 1
1) M is the set of all mortal people, N is the set of all nice people, T is the set of people who
trust are trusted, (a set of ordered pairs (x,y) such that x trusts y), and L is the set of people
who are liked, (a set of ordered pairs (x,y) such that x likes y). Using set builder notation,
define the following sets:
a. The set of nice people that are liked by someone
b. The set of people who like someone trusted.
c. The set of people that are mortal and nice.
d. The set of people who are liked by someone and trusted by the same person.
Problem 2
2) Give the power set P(S) for S = (1, 2, 3, 4, 5). How many
elements does it have?
Problem 3
3) Visit the SETL website, http://setl.org/setl-server.html, and
answer the following questions:
(i) Print the set of all odd integers through 200.
(ii) Print the set of all primes through 200.
(iii) How many elements are in the set difference between the
set from part (i) and the set from part (ii)?
Problem 4 from old PowerPoint
Visit the SETL website, http://setl.org/setl-server.html, and answer the
following questions:
(Give both the answer and the SETL code that generated you this answer.)
Note that sets are denoted by braces {}, the intersection operator for sets is
denoted by *, and the union operator for sets is denoted + in SETL. Using
parentheses, (), to denote a set is a more conventional notation than using
braces, {}.
A = (11, 4, 13, 4, 25, 6, (), (1, 2)), B = (1, 4, 25, 6, (), 17, 8, 9), and C = (4, 7, 8, 9,
10, (11, 12, 13), 12)
(i) What is the set difference between A and B?
(ii) What is the set difference between C and D = (11, 12, 13)?
Download