Purchase Solution

Application of Set-Theoretic Model of Sequences

Not what you're looking for?

Ask Custom Question

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.

Purchase this Solution

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.

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

Purchase this Solution


Free BrainMass Quizzes
Multiplying Complex Numbers

This is a short quiz to check your understanding of multiplication of complex numbers in rectangular form.

Solving quadratic inequalities

This quiz test you on how well you are familiar with solving quadratic inequalities.

Exponential Expressions

In this quiz, you will have a chance to practice basic terminology of exponential expressions and how to evaluate them.

Know Your Linear Equations

Each question is a choice-summary multiple choice question that will present you with a linear equation and then make 4 statements about that equation. You must determine which of the 4 statements are true (if any) in regards to the equation.

Geometry - Real Life Application Problems

Understanding of how geometry applies to in real-world contexts