+ 4
What is the use of Demorgan's Law??
In computer
3 Answers
+ 4
It is useful in digital circus at a low level.
+ 3
Please do not write formulas or code fragment in Relevant Tags. It was not what tags was for : )
https://www.sololearn.com/Discuss/333866/?ref=app
+ 2
while(!done && i != 10)
can be transformed to
while(!(done || i == 10))
So you'll occasionally find uses for it in programming aswell :)
De Morgan's law also works in any boolean algebra so if you set one up you can use it, for example:
Take a "mother-set" like {1,2,3,4,5} and consider all subsets like {1}, {2,5}, ...
Define `+` as union, for example:
{1,2} + {2,3} = {1,2,3}
Define `*` as intersection, for example:
{1,2} * {2,3} = {2}
Define `!` or `not` as subtracting from the mother set, for example:
!{1} = {2,3,4,5}
And then De Morgan works on sets:
!({1,2} * {2,3}) = !{1,2} + !{2,3}
Try it! It's kinda neat.