The problem has to do with the application of set theoretic models
1. Using the set-theoretic model of sequences, define the following operators,
giving their syntax and their semantics:
(a) overwrite: given any sequence, s, over a set X, any element, e, of X and any non-zero natural
number, n, return a sequence identical to s except that the element at position n is e.
For example, overwrite [a, b, c, d] f 3 = [a, b, f, d]
(b) insert: : given any sequence, s, over a set X, any element, e, of X and any non-zero natural
number, n, return a sequence identical to s except that e is at position n and every element of s
at position greater than n has been shifted right by one position.
For example, insert [a, b, c, d] f 3 = [a, b, f, c, d]
(c) take: given any sequence, s, over a set X and any non-zero natural number, n, return a
sequence consisting of the first n elements of s.
For example, take [a, b, c, d] 3 = [a, b, c] [5 marks]
(d) drop: given any sequence, s, over a set X and any non-zero natural number, n, return a
sequence containing all except the first n elements of s.
For example, drop [a, b, c, d] 3 = [d]
2. Using the theories of NAT and BOOL define the following operators as
conservative extensions:
(a) gte, the relation to which a pair of natural numbers belongs if the first is greater than or equalt
to the second.
For example, gte(5,5), gte(5,3) but not gte (3,5).
]
(b) sub, the partial operator that computes the difference between a pair of natural numbers (i.e.
subtracts the second from the first) and is defined only if the difference is a NAT.
For example, sub(5,3) = 2 but sub(3,5) is undefined [
(c) quotient, the partial operator that, given a pair of natural numbers, returns the highest natural
number by which the second can be multiplied without exceeding the first.
For example, quotient(7,3) = 1, quotient(3,7) = 0 but quotient(3,0) is undefined.
(d) remainder, the partial operator that, given a pair of natural numbers, returns the natural
number by which the first exceeds the product of the second and their quotient.
For example, remainder(7,3) = 4, remainder(3,7) = 3 but remainder(3,0) is undefined.
By OTA: John Hopkins, PhD (IP)
OTA Rating: 4.9/5
Your Price: $2.19 (original value ~$59.85)
What's included:
Page generated in 0.0115 seconds