If you are looking z-notation project assignment help which is related below practice exercise then you can contact us so we can help you.

__How to start z-editor__

Click below link to start z-editor:

__Practice Exercise__

__Practice Exercise__

__Question 1__

A tautology is a statement that is true for every valuation of the propositional variables it contains; a contradiction is a statement that is false for every valuation of the variables; and a contingency is a statement that is neither a

tautology nor a contradiction.

Which of the following are tautologies, which are contradictions, and which are contingencies?

(a) (p ^ Â¬ p) ) (p _ Â¬ p)

(b) (p ) Â¬ q) _ p

(c) ((p ^ q) ) r ) , (Â¬ r ) Â¬ (p ^ q))

In each case, you should present a truth table to justify your answer.

__Question 2__

Using the algebra of propositional logic, rewrite the propositions of Question 1 in their simplest equivalent forms. (By simplest, we mean the form that has the fewest logical connectives.) In each case you should justify the rewriting through a chain of equivalences of the form

(p ^ Â¬ p) ) (p _ Â¬ p)

,

...

__Question 3__

By constructing proof trees, show that the tautologies of Question 1 (if there are any) are theorems of the propositional calculus. In doing so, you may make use of any theorems proved during the course.

__Question 4__

You have been asked to design (via a formal model) a prototype for a new online music platform called Streamify. (Note: all of the remaining questions will leverage the definitions of this question.)

Three basic types are of initial interest: PlaylistId , SongId and UserId.

[PlaylistId , SongId, UserId]

A playlist consists of an injective, non-empty sequence of songs:

Playlist == iseq1 SongId

The initial specification of the system is as follows.

songs : F SongId

users : F UserId

playlists : PlaylistId !7 Playlist

playlist owner : PlaylistId !7 UserId

playlist subscribers : PlaylistId !7 F1 UserId

...

Complete the definition by capturing the following constraints.

(a) Only songs that appear in songs can appear in playlists.

(b) Only playlists that appear in playlists can appear in playlist owner.

(c) Only users that appear in users can appear in playlist owner.

(d) Only playlists that appear in playlists can appear in playlist subscribers.

(e) Only users that appear in users can appear in playlist subscribers.

(f) Every playlistâ€™s owner is, by default, a subscriber to that playlist.

__Question 5__

Users can love or hate songs. This information is captured via the following.

hated : UserId !7 F SongId

loved : UserId !7 F SongId

...

Complete the definition by capturing the following constraints.

(a) Only users that appear in users can appear in hated.

(b) Only songs that appear in songs can appear in hated.

(c) Only users that appear in users can appear in loved.

(d) Only songs that appear in songs can appear in loved.

(e) No user can both hate and love the same song.

__Question 6__

Show how the following â€” all of which rely on the definitions of the previous

two questions â€” can be represented via the mathematical language of Z.

(a) The users who have subscribed to no playlists.

(b) The playlists with at least 100 subscribers.

(c) The user who loves the most songs. (You should feel free to assume

that there is a unique such user.)

(d) The song that is loved by the most users. (Again, you should feel free

to assume that there is a unique such song.)

__Question 7__

Letâ€™s now consider two further functions. The first, length, maps a given

song (identifier) to its length (in seconds). The second, popularity, assigns a

popularity score to each song (identifier).

length : SongId !7 N

popularity : SongId !7 N

...

**(a) Complete the above definition, so that:**

songs appearing in length and popularity must appear in songs; and

the popularity of a score is determined by the difference between the number of people who love it and the number of people who hate it â€” with a non-positive score capped at 0 â€” multiplied by the number of playlists in which it appears.

So, for example, if a song is liked by 6 people, hated by 3 and appears in 10 playlists, then its popularity score will be 30. If, on the other hand, a second song is liked by 3 people, hated by 6 people and also appears in 10 playlists, then its popularity score will be 0.

(b) Define, via an axiomatic definition, the most popular song in that appears

in songs. If there is not a unique such element, the function

should return the null song, which is an element of SongId.

(c) Define, via a set comprehension, the set of playlists that feature the

most popular song that appears in songs. You should assume that

the null song appears in no playlists.

## Comments