Explore BrainMass

Explore BrainMass

    Application of Set-Theoretic Model of Sequences

    Not what you're looking for? Search our solutions OR ask your own Custom question.

    This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

    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.

    © BrainMass Inc. brainmass.com March 6, 2023, 1:16 pm ad1c9bdddf
    https://brainmass.com/math/boolean-algebra/application-set-theoretic-model-sequences-11624

    Attachments

    Solution Preview

    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]

    ans.
    syntax, overwrite : (Seq X) x X x NAT+ --> (Seq X)
    semantics, i not equal to n -> ( overwrite (s, e, n) ) i = s i
    i = n -> ( overwrite (s, e, n) ) i = e

    (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]

    ans.
    syntax, insert : (Seq X) x X x NAT+ --> Seq X
    semantics, i < n --> ( insert( s, e, n ) ) i = s i
    i = n --> ( ...

    Solution Summary

    Operators are defined using a set-theoretic model of sequences. The application of set theoretic model of sequences are given. Elements and non-zero natural numbers are given for a sequence function.

    $2.49

    ADVERTISEMENT