condition - Verify that the logic !(a==k || b==k || c==k) is not equivalent to (a != k || b!=k || c!=k) -


i ran bug in program had differentiate between cases stated in title. a,b,c distinct entities either a,b, or c may equal k.

my intent, represented compound logical statement, if a,b,or c equals k (a==k or b==k or c==k), statement should return false.

the buggy expression was: (a!=k || b!=k || c!=k) correction was: !(a==k || b==k || c==k) reasoning being former says @ a,b, , c needs equal k statement false.

i wanted verify correction.

(a == k || b == k || c == k) equivalent !(a != k && b != k && c != k). application of de-morgan's law.

the formal proof not easy not attempt give it. (but 1 of first proofs can once you've established mathematical axioms.) can prove statements not equivalent using counterexample: setting a != b mean (a != k || b != k || c != k) always true, !(a == k || b == k || c == k) might true.


Comments

Popular posts from this blog

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -