A piece of software stores information about digital songs

Assignment Help Mathematics
Reference no: EM13285308

Question 6

Consider the following scenario. -

A piece of software stores information about digital songs and keeps track of when they were listened to Each song is associated with a song name, an artist and an album title; each song is also associated with a unique identifier.

We assume the existence of a number of basic types.:

[SongName, Artist, Album Title, Id)

We also assume that a set, Time, has been defined. We algo assume an accompanying ordering relation, <Time, and a special element miltirne C Time.

We also assunie an abbreviation, Length:

Length == N

Two structures are of interest to us. The first, songs, captures the details of the songs stored by our software; the second, plays, captures 'play details' - which songs were played and when:songs : Id -I-, (SongNarne x Artist x Album Title x Length x Time) plays : seq (Id x Time)

Each element of the range of songs is a quintuple, consisting of: a song name; an artist; an album title; the length of the song (in terms of seconds); and the time at which the song was added.

Each element of plays is a pair, detailing which songs were played and when. So, for example, if the song associated with the identifier idl has been played three times, we would expect to see three entries for idl in plays_

The expectation is that each identifier appearing in plays will also appear in songs, that niltime will not appear in the range of plays, and that the elements of plays will be ordered from earliest to latest.

Add three constraints to the above axiomatic definition to enforce this behaviour.

Question 7

Building upon the definitions of Question 6, define set comprehensions that capture the following.

(a)   The set of all 'duplicate' songs - defined as (SongName, Artist) pairs - which appear in songs more than once.

(b)   The set of all songs___ again, defined as (SongName, Artist) pairs -
which have not been played.

(c)   The set of albums which have had none of their tracks played.

(d)   The set of all songs__ again, defined as (SongName, Artist) pairs -
which have been played more than 10 times.

Question 8

(a)   Define a recursive function, totalplaytirne, that sums up the length of time of the played songs appearing in a given sequence of type seq (Id x Time). Your function will need to make reference to songs.

(b)   Show, via an inductive proof, that

V s, t seq (Id x Time) •

totalplaytime (s t) = totalplaytime (s) totalplaytime (t)

Question 9

A structure combining information from songs and plays can be defined using the following definition:

SongsAndPlaysList == seq SongDetails 

We assume the existence of the following abbreviation:

SongDetails ==  Id × SongName × Artist × AlbumTitle ×  Length × Time × Time × N 

Here, the details of each song consists of: an identifier; a song name; an artist; an album title; the song length; the date it was added; the last time it was played; and the number of times it has been played.

(a) A valid element of SongsAndPlaysList will: ensure that there are no duplicate identifiers and ensure that any 'last played' time is later than

any 'date added' time. Define such a ValidSongsAndPlaysList structure. (b) Define a specific ValidSongsAndPlaysList, songs_and_plays, the values of which are defined by the values of songs and plays of Question 6.

(c) Show how the set comprehensions of Question 7 might be recast as set comprehensions on the sequence of part (b).

(d) Show how the recursive function of Question 8 might be recast as a function that takes a sequence of type seq SongDetails as input.

 

Question 10

You have been informed that the following statements are true:

  • "If the team wins all of its league matches, then the team will win the league."
  • "The team wins the cup if, and only if, the team wins all of its cup matches."

 

Assume that: AC represents "wins all cup matches"; AL represents "wins all league matches"; WC represents "wins the cup"; and WL represents "wins the league".

By using the above, prove each of the following via a proof tree.

(a) AC  Ù AL  => WC Ù WL  ( where AND = Ù)

(b) AC V AL => WC V WL (where V = or)

Each step in your tree should be labelled and justified by a basic introduction or elimination rule from our system.

Reference no: EM13285308

Questions Cloud

State reacts with the zinc and then neutralizing excess hcl : The zinc content of a 1.45 g ore sample was determined by dissolving the ore in HCl, which reacts with the zinc, and then neutralizing excess HCl with NaOH
What are the rates with continuous compounding : The 6-month, 12-month, 18-month, and 24-month zero rates are 3.00%, 3.50%, 4.00%, and 4.50% with semi-annual compounding.
Unethical practices and behavior in accounting : Identify situations that might lead to unethical practices and behavior in accounting. Do you think the Sarbanes-Oxley Act has made a difference in the ethical behavior of companies regarding their financial accounting? Why or why not?
Discuss the differences between cash flow and accounting : Discuss the differences between cash flow and accounting income and why it is important to use cash flow in making capital budgeting decisions.
A piece of software stores information about digital songs : A piece of software stores information about digital songs and keeps track of when they were listened to Each song is associated with a song name, an artist and an album title; each song is also associated with a unique identifier.
Explain copper are produced when excess aluminum reacts : how many grams of copper are produced when excess aluminum reacts with 11.0 g of copper oxide.
What is the wavelength of such a sound in seawater : Blue whales apparently communicate with each other using sound of frequency 17.0, What is the wavelength of such a sound in seawater
Define the rate law for a reaction is rate : The rate law for a reaction is rate = k[A]^2 [B]. When the concentration of A and B are both 0.15M, the reaction rate is 0.115M/s. What would be the reaction rate when [A] = 0.30M and [B] = 0.45M

Reviews

Write a Review

Mathematics Questions & Answers

  Prepare the journal entry recording the scrapping

The original cost of the speaker was $500 and lozz had recognized $100 of depreciation on it at the time of scrapping. Prepare the journal entry recording the scrapping of the speaker.

  How many ounces of each of the original alloys must be used

A jeweler needs to mix an alloy with 14% gold content and an alloy with a 24% gold content to obtain 50 ounces of a new alloy with exactly 20% gold content. How many ounces of each of the original alloys must be used? [Round to the nearest tenth o..

  Explanation of implicit differentiation

Find dy/dx by implicit differentiation. where p is the unit price in dollars and x is the quantity demanded each week, measure in units of a thousand. Compute the elasticity of demand and determine whether the demand is elastic, inelastic, or unit..

  Find the hypothesis

Find the hypothesis

  Make a confidence interval at the 95 percent level

Make a confidence interval at the 95 percent level

  Determine the equation of the line

You are estimating the cost ($K) of optical sensors based on the resolution of the sensor (i.e. how small of an object it can detect). Using the preliminary calculations from a data set of 8 sensors, determine the equation of the line. (Round your..

  Definitions of mutually-exclusive and independent events

Let E and F be non-zero-probability events. If E and F are mutually-exclusive, can they also be independent?

  Determining complex spectral theorem

Suppose that V is a complex (i.e. F = C) inner-product space. Prove that if N, an element of L(V), is normal and nilpotent, then N = 0.

  What is the height of the kite to the nearest foot

A kite has a string of 500 ft. long. If the string makes an angle of 52 degrees with the ground, what is the height of the kite to the nearest foot?

  What is the probability that the second battery

(a) what is the probability that the total life of both batteries will exceed 760 hours? (b) what is the probability that the second battery will outlive the first by at least 25 hours?

  State water flows into a partially-filled rectangular tank

A steady stream of water flows into a partially-filled rectangular tank. After 6 minutes, there are 87 gallons of water in the tank. After 21 minutes, there are 222 gallons. Write an equation to represent the volume of water in the tank y after x ..

  Probability counting principle

Probability : Counting Principle, A social security number has 9 digits. How many different S.S numbers are possible if:

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd