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