3

I was reading my notes, and I came across this:

Another example would be to find the names of the lecturers teaching all modules. We might reach for the following incorrect expression:

{<N> | ∃M ∀C ∀MN ∀Cr (lecturer(M, N) ∧ module(C, MN, Cr) ∧ teach(M, C))}

Instead, the following is more accurate:

{<N> | ∃M ∀C ∀MN ∀Cr (lecturer(M, N) ∧ (module(C, MN, Cr) → teach(M, C)))}

The first one states that as long as there exists a lecturer who has taught a module that exists in the database, the name will be returned (which is not what we want). Or at least that is how I interpreted this.

Is there any reason why the first expression is incorrect and (more importantly) the second one is correct?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.