Query to get all employees that report to themselves.

24 Views Asked by At

I have two predicates:

$Employee/1$ and $ReportsTo/2$

and let's say we have two constants:

$Patrick/0:$ and $Octo/0:$

The predicate $ReportsTo/2$ takes two Employees, one reports to the other. It is allowed that a employee reports to himself.

f.ex.: $ReportsTo(Patrick,Patrick)$ is allowed.

My course asked to construct a query that returns all employees who report to themselves so I came up with:

{x : Emp(x) ∧ Rep(x, x)}

But apparently that ain't correct, the correct answer is:

{x : Emp(x) ∧ Rep(x, x) ∧ (∀y)(Emp(y) ∧ Rep(x, y) → x = y))}

Can someone explain why this part is needed:

$∧ (∀y)(Emp(y) ∧ Rep(x, y) → x = y)$

Thank you.

1

There are 1 best solutions below

1
On BEST ANSWER

For the question as stated, it isn't needed, but perhaps the original question asks for "employees who report to themselves and only themselves"?