-4

我有这个逻辑运算符表达式:

!(!(a != b) && (b > 7))

你如何简化它并找到等价物?

4

2 回答 2

2

使用德摩根定律

!(!(a != b) && (b > 7))
!!(a != b) || !(b > 7)
a != b || b <= 7
于 2016-11-13T17:06:38.213 回答
0

正如其他人提到的:德摩根定律

!(!(a != b) && (b > 7)) // x != y --> !(x == y) 
!(!!(a == b) && (b > 7)) // !!x --> x 
!((a == b) && (b > 7)) // !(x && y) --> !x || !y
!(a == b) || !(b > 7) // !(x == y) --> x != y;; !(x > y) --> x <= y
(a != b) || (b <= 7)
于 2016-11-13T17:31:49.580 回答