sulli1

01-25-2006, 06:24 PM

Hi All,

Please could somebody advise me on my query about truth tables?

Is

NOT (NOT A AND B) as shown below

A B

T T

F F

and does

A OR NOT B mean the same thing?

A B

T T

F F

This was part of a question in an assignment that I had to submit by yesterday, which I did, but unfortunately I still don't think I have the gist of this!

Thank you in advance.:confused:

Not quite sure what this has to do with Javascript, and my formal logic is a bit rusty, but basically, it depends what you mean by 'means the same as'. As I remember, there are two ways of saying this with logic, 'entailment' and something else that I forget the term for, |= and |- if you're writing them I believe.

Dpending on which you want to use, then the answer is 'yes' or 'no', but I forget which way round. If you have a textbook for this, then it will probably tell you, as I think this was an example of the difference on our course.

I could, of course, be getting confed, and this might all be wrong.

sulli1

01-25-2006, 07:44 PM

Hi GJay,

Thanks for your reply to my query. The truth table was part of an assignment that I have just had to submit in my Javascript course, so although I am having trouble getting my head around it it must have something to do with Javascript somewhere along the line. The problem I am having is with the double negative, ie; does NOT (NOT A AND B) mean it is A and B, ie; A is True and B is True? The way I have written the table is exactly how it was posed in the test paper.

Thanks for trying to help though.

Kindest regards,

Jenny

a=array(true,false);

b=array(true,false);

i=0;

while(i<a.length) {

j=0;

while(j<b.length) {

alert((!(!a[i]&&!b[j]))==(a[i]||!b[j]));

j++;

}

i++;

}

Will show whether the statement:

!(!a&&!b))=a||!b

is always true (i.e. each side is the same)

sulli1

01-25-2006, 11:52 PM

:thumbsup: Hi GJay,

Thank you for your coding, I really appreciate your help.

Kindest regards,

Jenny

Just use DeMoivre's theorem:

!(!A & B) = !!A | !B = A | !B

Thus, NOT (NOT a AND b) is equivalent to: a OR NOT b