I am trying to simplify the following using DeMorgan's Law: ! (x!=0 || y !=0)
Does x!=0 simplify to x>0? Or am I wrong in the following:
!(x>0 || y>0)
!(x>0) && !(y>0)
((x<=0) && (y<=0))
Thanks.
De Morgan's First Law states that the complement of the union of two sets is the intersection of their complements. Whereas De Morgan's second law states that the complement of the intersection of two sets is the union of their complements. These two laws are called De Morgan's Law.
DeMorgan's first theorem states that two (or more) variables NOR´ed together is the same as the two variables inverted (Complement) and AND´ed, while the second theorem states that two (or more) variables NAND´ed together is the same as the two terms inverted (Complement) and OR´ed.
De Morgan's Law states that how mathematical statements and concepts are related through their opposites. In set theory, De Morgan's Laws describe the complement of the union of two sets is always equals to the intersection of their complements.
Does x!=0 simplify to x>0?
No that's not true. Because integers are signed.
How to simplify :
!(x!=0 || y !=0)
?
Consider this rules :
(second De Morgan's laws )
By 1., it implies
!(x!=0 || y !=0) <=> (!(x!=0)) && (!(y != 0))
By 2., it implies
(!(x!=0)) && (!(y != 0)) <=> (x == 0) && (y == 0)
for(int x = -5; x < 5; x++){
for(int y = -5; y < 5; y++){
if(!(x!=0 || y !=0))
System.out.println("True : ("+x+","+y+")");
}
}
DeMorgans Law states the following:
!(A & B) = !A | !B (I)
!(A | B) = !A & !B (II)
In your case (II)
applies: !(x!=0 || y!=0)
=> !(x!=0) && !(y!=0)
=> (x==0) && (y==0)
PS: Your question: "Does x!=0 simplify to x>0?" can be answered with "no" unless x can not take negative values (for example if the type of x is unsigned).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With