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'sR = !(X && Y)
, for some X and Y. - The F comes when A is T and B is F; so
X = A
andY = !B
, i.e.R = !(A && !B)
- Using De Morgan's laws, that can be simplified to
R = !A || B
.