A Problem in Logic (42)

16 Name: #!/usr/bin/anonymous : 2008-05-04 19:19 ID:MuJs/AX1

>>15
First of all, I acknowledged my mistake as well as the confusion it would bring, early on.
Second, my attitude was only brought about because you called me "fucking retarded".
Third, your answer is still wrong.

I suppose I failed miserably to explain this problem, but I'm going to try once more.

We are given a function called threeDifferent(). It does not need to be defined, it is given to us. What this function does is take three integer arguments and determine whether or not they are all different. If they are all different it returns true. If any of them are the same, it returns false. Here are some examples:

threeDifferent( 1, 2, 3 ) *returns* TRUE
threeDifferent( 1, 2, 1 ) *returns* FALSE

In the first case, all three integers are different. In the next case, the first and the last are the same, so no.

Now what I want is a function called fourEqual() defined using threeDifferent(). What fourEqual() does is determine if four integers are all equal. Here are some examples:

fourEqual( 1, 1, 1, 1) *returns* TRUE
fourEqual( 1, 2, 1, 1) *returns* FALSE

In the first case, each argument is 1, so they are in fact all equal. In the second case, 2 is different, so they are not equal.

Now, lets look at your code:

fE(a, b, c, d) <- !tD(a, b, c) && !tD(a, b, d)

In particular, the case of (1, 2, 1, 1)

fE(1, 2, 1, 1) <- !tD(1, 2, 1) && !tD(1, 2, 1)

Obviously (1, 2, 1, 1) are not all equal, so fE(1, 2, 1, 1) should return FALSE.
And (1, 2, 1) are not all different, so tD(1, 2, 1) should return FALSE. Why? Because they are not all different.
So, the result of evaluating !tD(1, 2, 1) is TRUE.
So, the expression

!tD(1, 2, 1) && !td(1, 2, 1) 

becomes

!(FALSE) && !(FALSE)
TRUE && TRUE
TRUE

Therefore, your function fE(1, 2, 1, 1) will return TRUE. But is it true that they are all equal? NO.

This thread has been closed. You cannot post in this thread any longer.