Boolean Simplification - boolean-logic

I have a boolean simplification problem that's already been solved.. but I'm having a hard time understanding one basic thing about it.. the order in which it was solved.
The problem is simplifying this equation:
Y = ¬A¬B¬C + ¬AB¬C + A¬B¬C + A¬BC + ABC
The solution is:
Y = ¬A¬B¬C + ¬AB¬C + A¬B¬C + A¬BC + ABC
= ¬A¬B¬C + ¬AB¬C + A¬B¬C + A¬BC + A¬BC + ABC (idempotency for A¬BC)
= ¬A¬C(¬B + B) + A¬B(¬C + C) + AC(¬B + B)
= ¬A¬C + A¬B + AC
The way I solved it is:
Y = ¬A¬B¬C + ¬AB¬C + A¬B¬C + A¬BC + ABC
= ¬A¬B¬C + ¬AB¬C + ¬A¬B¬C + A¬B¬C + A¬BC + ABC (idempotency for ¬A¬B¬C)
= ¬A¬C(¬B + B) + ¬B¬C(¬A + A) + AC(¬B +B)
= ¬A¬C + ¬B¬C + AC
So how do I know which term to use the law of idempotency on? Thanks.

¬A¬B¬C + ¬AB¬C + A¬B¬C + A¬BC + ABC
¬A¬C(¬B + B) + A(¬B¬C + ¬BC + BC)
¬A¬C + A(¬B¬C + ¬BC + BC) <- see truth table below for the simplification of this
¬A¬C + A(¬B + C)
¬A¬C + A¬B + AC
truth table:
B C
0 0 = 1 + 0 + 0 = 1
0 1 = 0 + 1 + 0 = 1
1 0 = 0 + 0 + 0 = 0
1 1 = 0 + 0 + 1 = 1
which is ¬B + C

Related

Boolean truth table into SOP and Karnaugh Map

Hi, I am junior in college and having trouble with my computer architecture classwork. Anyone care to help & tell me if I got them right?
Question1. Convert truth table into bool equation.
Question2. Find miminum SOP(sum of products)
Question3. Use K-map(Karnaugh map) to simplify.
You can simplify the original expression matching the given truth-table just by using Karnaugh maps:
f(x,y,z) = ∑(1,3,4,6,7) = m1 + m3 + m4 + m6 + m7
= ¬x·¬y·z + ¬x·y·z + x·y·z + x·¬y·¬z + x·y·¬z //sum of minterms
f(x,y,z) = ∏(0,2,5) = M0 · M2 · M5
= (x + y + z)·(x + ¬y + z)·(¬x + y + ¬z) //product of maxterms
f(x,y,z) = x·y + ¬x·z + x·¬z //minimal DNF
= (x + z)·(¬x + y + ¬z) //minimal CNF
You would get the same result using the laws of Boolean algebra:
¬x·¬y·z + ¬x·y·z + x·y·z + x·y·¬z + x·¬y·¬z
¬x·(¬y·z + y·z) + x·(y·z + y·¬z + ¬y·¬z) //distributivity
¬x·(z·(¬y + y)) + x·(y·(z + ¬z) + ¬y·¬z)) //distributivity
¬x·(z·( 1 )) + x·(y·( 1 ) + ¬y·¬z)) //complementation
¬x·(z ) + x·(y + ¬y·¬z)) //identity for ·
¬x·(z ) + x·(y + y·¬z + ¬y·¬z)) //absorption
¬x·(z ) + x·(y + ¬z·(y + ¬y)) //distributivity
¬x·(z ) + x·(y + ¬z·( 1 )) //complementation
¬x·(z ) + x·(y + ¬z) //identity for ·
¬x·z + x·y + x·¬z //distributivity
¬x·z + x·y + x·¬z //minimal DNF
¬x·z + x·y + x·¬z
¬x·z + x·(y + ¬z) //distributivity
(¬x + x)·(¬x + (y + ¬z))·(z + x)·(z + (y + ¬z)) //distributivity
( 1 )·(¬x + y + ¬z )·(z + x)·(z + y + ¬z) //complementation
( 1 )·(¬x + y + ¬z )·(z + x)·(y + 1) //complementation
( 1 )·(¬x + y + ¬z )·(z + x)·(1) //annihilator for +
(¬x + y + ¬z )·(z + x) //identity for ·
(¬x + y + ¬z)·(x + z) //minimal CNF

Simplify boolean expression: (a + b)(b'+ c)(a + c) = (a + b)(b'+ c)

Hello I am trying to simplify this expression (proving consensus expression):
(a + b)(b'+ c)(a + c) = (a + b)(b'+ c)
I was thinking of adding (a+b)(b'+ c)(a + c + b' + b), but I don't know what to do after.
Take a look at this:
(a + b)(b' + c)(a + c)
= (ab' + 0 + ac + bc)(a + c)
= (ab' + ab'c +ac + ac + abc + bc)
= (ab' + ab'c + ac + abc + bc)
= (ab'(1+c) + ac + bc(a + 1))
= (ab' + ac + bc)
= (ab' + c(a+b))
= (ab' + bb' + c (a+b))
= (a+b)(b' + c)
The key step is realising that bb' = 0 so you can safely add that term without affecting the result in the penultimate step.
(A+C')(B'+C')
AB'+AC'+BC'+C'
AB'+(A+B+1)C'
We Know ( 1+anything =1)
So required expression AB'+C' .

Replace just start of string in sql

I have 3 columns in my table:
+-+-+-+-+-+-+-+-+-+-+-++
+ ID + Name + Cell +
++++++++++++++++++++++++
+ 1 + FB + /moon/ta +
+ 2 + GO + /ta/ta +
+ 3 + MO + /ta/mon +
+ 4 + SS + /ta +
+ 4 + SS + /ta/o/ta +
+-+-+-+-+-+-+-+-+-+-+-++
I want to replace all "/ta" with "/rr" in cell that start of string, like:
+-+-+-+-+-+-+-+-+-+-+-++
+ ID + Name + Cell +
++++++++++++++++++++++++
+ 1 + FB + /moon/ta +
+ 2 + GO + /rr/ta +
+ 3 + MO + /rr/mon +
+ 4 + SS + /rr +
+ 4 + SS + /rr/o/ta +
+-+-+-+-+-+-+-+-+-+-+-++
How can I do this in SQL?
I think this does what you want:
update table t
set cell = concat('/rr', substr(cell, 4))
where cell like '/ta%';

Simplifying a logic function using boolean algebra

I'm taking a class on digital logic and I am having a hard time with boolean algebra and simplifying logic functions with it. I have tried answering this problem several times and I keep coming to the answer "1", which I feel is absolutely wrong.
The question is
Consider the logic function f(a,b,c) = abc + ab'c + a'bc + a'b'c + ab'c'. Simplify f using Boolean algebra as much as possible.
I have tried solving it several ways using the boolean identities given in my textbook and from lecture, but I keep coming to something like c + 1 which is equivalent to 1, which I don't feel is the correct answer considering the next question in the problem.
Here is my last attempt:
f(a,b,c) = abc + ab'c + a'bc + a'b'c + ab'c'
= a(bc + b'c + b'c') + a'(bc + b'c) # Distributive, took out the a and the a' separately.
= (a + a')((bc + b'c + b'c') + (bc + b'c)) # Distributive(?), took out the a and a' together (This is probably where I screwed up).
= (1)((c + b'c') + c) # a + a' = 1; bc + b'c = c (Combining).
= c + b'c' + c # cleaned up a little.
= c + b'c' # c + c = c.
= c + (b' + c') # b'c' = b' + c' (DeMorgan's Theorem).
= 1 + b' # c + c' = 1.
= 1 # 1 + b' = 1
This feels absolutely wrong to me, and the next question asks me to make the logic circuit for it, which I don't think is possible.
Can anyone help/walk me through what I am doing wrong? I would really appreciate it. :(
(P.S. I used code formatting, I apologize if this is annoying to some.)
By this table:
A 1 1 1 1 0 0 0 0
B 1 1 0 0 1 1 0 0
C 1 0 1 0 1 0 1 0
Y 1 0 1 1 1 0 1 0
Y=ab'+c
I've got it :D
f(a,b,c) = abc + ab'c + a'bc + a'b'c + ab'c'
= a(bc + b'c + b'c') + a'(bc + b'c)
= a(c(b + b') + b'c') + a'(c(b + b'))
= a(c * 1 + b'c') + a'(c * 1)
= a(c + b'c') + a'c
= a(c'(b'c')')' + a'c
= a(c'(b + c))' + a'c
= a(c'b +cc')' + a'c
= a(c'b)' + a'c
= a(c+b') + a'c
= ac + ab' + a'c
= c(a + a') + ab'
= ab' + c

MySQL UPDATE with subquery with group by

I have the following tables on MySQL:
**Elements**
+------+------------------+------------------+
+ Id + Name + referenced +
+------+------------------+------------------+
+ 1 + element1 + NULL +
+ 2 + element2 + NULL +
+ 3 + element3 + NULL +
+ 4 + element4 + NULL +
+ 5 + element5 + NULL +
+ 6 + element6 + NULL +
+------+------------------+------------------+
**References**
+------+------------------+------------------+
+ Id + Name + type +
+------+------------------+------------------+
+ 1 + element1 + 1 +
+ 2 + element1 + 2 +
+ 3 + element3 + 1 +
+ 4 + element3 + 2 +
+ 5 + element3 + 3 +
+ 6 + element4 + 1 +
+ 7 + element5 + 2 +
+ 8 + element5 + 3 +
+------+------------------+------------------+
The "referenced" column on "Elements" table should have 0 for no reference of its name on "References" table and 1 for at least one reference of its name on "References" table.
This result could be selected with the following query:
SELECT Elements.Id, Elements.Name, (References.Id is not null) as referenced FROM
Elements
LEFT JOIN
References ON Elements.Name = References.Name
GROUP BY Elements.Name ORDER by Elements.Id;
+------+------------------+------------------+
+ Id + Name + referenced +
+------+------------------+------------------+
+ 1 + element1 + 1 +
+ 2 + element2 + 0 +
+ 3 + element3 + 1 +
+ 4 + element4 + 1 +
+ 5 + element5 + 1 +
+ 6 + element6 + 0 +
+------+------------------+------------------+
But I could't find a way to update the "Elements" table with this result.
Any ideas?
UPDATE Elements e
LEFT JOIN References r ON e.OneName = r.OtherName
SET e.referenced = r.OtherName IS NOT NULL;