Boolean Simplification - Why does (A + NOT(B.C)).(B + NOT(B.C)).(C + NOT(B.C)) = A + NOT B.C [closed] - boolean

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 2 years ago.
Improve this question
This is the answer to the equation, but I do not understand why. Please help!

If you apply the Laws of Boolean Algebra one by one, the solution is a direct result:
de Morgan´s Theorem: The complement of two terms joined together by OR is the same as the complements of two terms joined by AND, and vice versa (i.e. NOT(A + B) = NOT(A) * NOT(B) and NOT(A * B) = NOT(A) + NOT(B)).
Commutative Law: The order of joining two separate terms with AND or OR is not important.
Complement Law: A term joined with its complement with AND equals 0 respectively with OR equals 1 (i.e. A * NOT(A) = 0 and A + NOT(A) = 1).
Annulment Law: A term joined with AND with 0 equals 0 and joined with OR with a 1 equals 1 (i.e. A * 0 = 0 and A + 1 = 1).
Identity Law: A term joined with 1 by AND or with 0 by OR is equal to itself (i.e. A * 1 = A and A + 0 = A).
(there are more, but you don't need them here)
Applied to your term:
(A + NOT(B*C)) * (B + NOT(B*C)) * (C + NOT(B*C))
[with 1.] = (A + NOT(B) + NOT(C)) * (B + NOT(B) + NOT(C)) * (C + NOT(B) + NOT(C))
[with 2.] = (A + NOT(B) + NOT(C)) * (B + NOT(B) + NOT(C)) * (C + NOT(C) + NOT(B))
[with 3.] = (A + NOT(B) + NOT(C)) * (1 + NOT(C)) * (1 + NOT(B))
[with 4.] = (A + NOT(B) + NOT(C)) * 1 * 1
[with 5.] = (A + NOT(B) + NOT(C))
[with 1.] = (A + NOT(B*C))

Related

How to get the maximum value in an array using SQL?

Task
Given three integers a, b, c, return the largest number obtained after inserting the following operators and brackets: +, *, ()
In other words, try every combination of a,b,c with [*+()] and return the Maximum Obtained
Example
With the numbers are 1, 2 and 3, here are some ways of placing signs and brackets:
1 * (2 + 3) = 5
1 * 2 * 3 = 6
1 + 2 * 3 = 7
(1 + 2) * 3 = 9
So the maximum value that you can obtain is 9.
Notes
The numbers are always positive.
You can use the same operation more than once.
You cannot swap the operands. For instance, in the given example you
cannot get expression (1 + 3) * 2 = 8.
I have created every combination and put it in an array.
SELECT a,b,c, ARRAY[
a * b * c,
a + b + c,
a * b + c,
a + b * c,
(a + b) * c,
a * (b + c)
] AS res
FROM expression_matter
Select result is the following:
a b c res
2 1 2 {4,5,4,4,6,6}
2 1 1 {2,4,3,3,3,4}
2 2 4 {16,8,8,10,16,12}
3 3 3 {27,9,12,12,18,18}
1 1 1 {1,3,2,2,2,2}
Now, I have to obtain the maximum value in this array. But the MAX or GREATEST functions do not working as expected. The SELECT GREATEST(ARRAY[...]) returns with same result. The SELECT MAX(ARRAY[...]) returns with the maximum value for every combination respect to all row.
I would like to obtain the maximum value of every combination in each row.
Use the GREATEST function and replace the array to list of arguments.
SELECT GREATEST(
a * b * c,
a + b + c,
a * b + c,
a + b * c,
(a + b) * c,
a * (b + c)
) AS res
FROM expression_matter
The GREATEST returns the greatest of the list of one or more expressions. See documentation here.

Simplifying Boolean algebra expression with two brackets

Could someone please show me how to get the answer? The correct answer is c):
Simplify the following Boolean algebraic expressions (where ’ means not):
A.B’ + A.(B + C)’ + B.(B + C)’
a) B.C’
b) B + C
c) A.B’
d) A + B’
e) None of the above
First simplify the parentheses
A.B’ + A.(B + C)’ + B.(B + C)’=
A.B’ + A.B’.C’ + B.B’.C’
Now B.B’=0 so the third term is gone:
A.B’ + A.B’.C’
Now you can regroup A.B’:
A.B’.(1 + C’)
Finally 1+C’=1 so all that's left is
A.B’

Boolean Expression with Laws

Hello can somebody help me? How this boolean expression simplified?
abcd + d
it simplified as:
d
im trying to use the Laws I don't understand at all
Here's the Laws
Basic Boolean Laws
Idempotent Law
A * A = A
A + A = A
Associative Law
(A * B) * C = A * (B * C)
(A + B) + C = A + (B + C)
Commutative Law
A * B = B * A
A + B = B + A
Distributive Law
A * (B + C) = A * B + A * C
A + (B * C) = (A + B) * (A + C)
Identity Law
A * 0 = 0 A * 1 = A
A + 1 = 1 A + 0 = A
Complement Law
A * ~A = 0
A + ~A = 1
Involution Law
~(~A) = A
DeMorgan's Law
~(A * B) = ~A + ~B
~(A + B) = ~A * ~B
Redundancy Laws
Absorption
A + (A * B) = A
A * (A + B) = A
(A * B) + (A * ~B) = A
(A + B) * (A + ~B) = A
A + (~A * B) = A + B
A * (~A + B) = A * B
Thanks in advance!
It's indeed D, by the following:
abcd+d -> (a+d)*(b+d)*(c+d)*(d+d) // Distributive Law
(a+d)*(b+d)*(c+d)*(d+d) -> (a+d)*(b+d)*(c+d)*d // Idempotent Law - d+d=d
(a+d)*(b+d)*(c+d)*d -> (a+d)*(b+d)*d // Redundancy Laws - (c+d)*d = d
(a+d)*(b+d)*d -> (a+d)*d // Redundancy Laws - (b+d)*d = d
(a+d)*d -> d // Redundancy Laws - (a+d)*d = d
Boolean Expression: abcd + d can be simplified as -
LHS = abcd + d [Assume: abcd + d*1 as A * 1 = A ]
= d(abc + 1) [Distributive Law]
= d(1 + abc)
= d(1) [Identity Law (A + 1 = 1)]
= d [Identity Law (A * 1 = A)]
= RHS

how to modify self-defined scala operators' precedence

Is it possible to modify the precedence of any self-defined operators?
For example, I implement elementary arithmetic with totally self-defined operators.
case class Memory(name:String){
var num:Num = null
def <<=(x:Num): Unit = {
println(s"assign ${x.value}")
this.num = x
}
}
case class Num(var value:Int) {
def +|+(x:Num) = {
println("%d + %d = %d".format( value,x.value,x.value + value ))
Num(value + x.value)
}
def *|*(x:Num) = {
println("%d * %d = %d".format( value,x.value,x.value * value ))
Num(value * x.value)
}
}
val m1 = Memory("R")
val a = Num(1)
val b = Num(3)
val c = Num(9)
val d = Num(12)
m1 <<= a *|* b +|+ c +|+ d *|* a
println("final m1 ",m1.num.value)
The results are
1 * 3 = 3
3 + 9 = 12
12 * 1 = 12
12 + 12 = 24
assign 24
(final m1 ,24)
Apparently the precedence is correct. I want *|* be the same precedence as * and +|+ the same as +, <<= is equivalent as = as well. How scala figure it out?
Answering the question about modyfing operator precedence - to change it you basically just have to change the first character of your custom operator - this is how scala figures out precedense for infix operators, by just looking at the first character. So if you eg. add an operator *|+:
It will have same precedence as *|*, like with * and *.
"Bigger" precedence than +|+, just like with * and +.
Unfortunately there is no other way to deal with it right now. No custom annotations/weights and so on to avoid making reading code too fuzzy.
The precedence rules are very well summarized here - Operator precedence in Scala.
About your issue though - you get the right results.
*|*, as well as * are left-associative operators and their first character is *, so they have equal precedense.
Your operation:
a *|* b +|+ c +|+ d *|* a
Translates to
a * b + c + d * a, which is 1 * 3 + 9 + 12 * 1.
Applying standard precedence rules - (a*b) + c + (d*a) result is 24.

Anyone knows Reduce Boolean Expression

Anyone can help me reduce this to 4 literals?
F = ( A + C + D) ( A + C + D') (A + C' + D) ( A + B')
i tested in logic friday the answer was F = C D B' + A.
Assuming the ⋅ operator represents binary conjunction, the + binary disjunction and the ' or the ¬ unary negation, I would apply the laws of Boolean algebra this way:
(a + c + d)⋅(a + c + ¬d)⋅(a + ¬c + d)⋅(a + ¬b)
((a + d) + (c⋅¬c))⋅(a + c + ¬d)⋅(a + ¬b) //distributivity
((a + d) + (0))⋅(a + c + ¬d)⋅(a + ¬b) //complementation: c⋅¬c = 0
(a + d)⋅(a + c + ¬d)⋅(a + ¬b) //identity for +: (a + d) + (0) = (a + d)
(a) + (d⋅(c + ¬d)⋅¬b) //distributivity
(a) + ((d⋅c + d⋅¬d))⋅¬b) //distributivity: d⋅(c + ¬d) = (d⋅c + d⋅¬d)
(a) + ((d⋅c + 0))⋅¬b) //complementation: d⋅¬d = 0
(a) + (d⋅c⋅¬b) //identity for +: (d⋅c + 0) = d⋅c
a + ¬b⋅c⋅d
The final line is the minimal DNF. You can also transform it to it's minimal CNF this way:
(a) + (¬b⋅c⋅d)
(a + ¬b)⋅(a + c)⋅(a + d) //distributivity
For this small number of variables, you could have used Karnaugh maps to quickly find the minimal forms or to control your result. In the following picture (generated using latex) is the original expression next to it's minimal DNF and minimal CNF.
After finding the mean term you can use
Quine McCluskey Technique to solve the experssion. The result will same as K-Map. But it is fast technique for many veriable boolean expression.
Quine McCluskey online solver