Home > Software engineering >  How can emulate an IMPLY gate?
How can emulate an IMPLY gate?

Time:09-24

I have a condition that is:

#############
| A | B | R |
#############
| T | T | T |
-------------
| T | F | F |
-------------
| F | T | T |
-------------
| F | F | T |
-------------

This is an imply gate. How can achieve this in Java?

CodePudding user response:

It's quite easy to work out looking at the R column:

  • 3 Ts and 1F: X && Y would have 3Fs and 1T, so it's R = !(X && Y), for some X and Y.
  • The F comes when A is T and B is F; so X = A and Y = !B, i.e. R = !(A && !B)
  • Using De Morgan's laws, that can be simplified to R = !A || B.
  • Related