Can someone please help me with a,b,d,f Define the domain of discourse for two v
ID: 3666426 • Letter: C
Question
Can someone please help me with a,b,d,f
Define the domain of discourse for two variables x and y to be the set of musicians in an orchestra. Define the following predicates:
S(x): x plays a stringed instrument.
B(x): x plays a brass instrument.
P(x, y): x practices harder than y
Give a quantified expression that is equivalent to the following English statements:
a) There are no brass players in the orchestra.
b) All the string players practice harder than all the brass players.
c) Sam practices more than anyone else in the orchestra.
d) Exactly one person practices more than Sam.
e) There is someone in the orchestra who plays a stringed instrument and a brass instrument.
f) Everyone practices more than Nancy.
g) There is a brass player who practices harder than all the string players.
Explanation / Answer
a) Expression for - no brass players in the orchestra: As given B(x) tell whether a player x plays brass instrument or not.
Let X be the set of all players in the orchestra, then:
--------------------------------------------
count_of_brass_players = 0
For each player x in X
if B(x) then
count_of_brass_players = count_of_brass_players+1
end if
end For
if count_of_brass_players == 0 then
print("No brass players in orchestra)
end if
-----------------------------------
b) Expression for - all string players practice harder than all the brass players.
Given P(x,y) gives whether x practices harder than y. S(x) gives whether x plays a string instrument or not. B(x) gives whether x plays a brass instrument or not. Then, let X be the set of all players x in orchestra:
---------------------------------------
count=0
For each S(x) and B(y) in X
if P(S(x), B(y)) then
count =count+1
end if
end For
if count == count_string_players then
print("All string players practice harder than all brass players")
end if
--------------------------------------
d) Expression for - Exactly one person practices more than Sam in orchestra:
Given P(x,y) gives whether x practices harder than y.
Let X be the set of all players x in orchestra. Then?
-------------------------------------------------
Find a person x' that practices less than all other persons in orchestra except Sam.
if P(x', Sam) then
print("x' practices harder than Sam.")
end if
-----------------------------------
f) Expression for - Everyone practices more than Nancy.
Given P(x,y) gives whether x practices harder than y.
Let X be the set of all players x in orchestra. Then?
--------------------------------
count=0
For each player x in X except Nancy
if P(x,Nancy) then
count=count+1
end if
end For
if count == n(X) -1 then
print("Everyone practices more than Nancy.")
end if
----------------------------------