Boolean: How to convert a NAND4 to a NAND2 - boolean

I have the following problem. My equation is:
NAND2(NAND4(d,c,-b,a),NAND2(c,-a))
the "-" represents "NOT". I am not allowed to use NAND4, I am only allowed to use NAND2.
How do I convert this?
Thanks

NAND in general is equivalent to NOT(AND(…))
AND4(a, b, c, d) is equivalent to AND2(AND2(a, b), AND2(c, d))
NAND4(a, b, c, d) is thus equivalent to NOT(AND4(a, b, c, d)) and that’s equivalent to NOT(AND2(AND2(a, b), AND2(c, d)))
This is equivalent to NAND2(AND2(a, b), AND2(c, d))
If you were only allowed to use NANDs but not ANDs, you could invert the ANDs there: NAND2(NOT(NAND2(a, b)), NOT(NAND2(c, d)))

Related

How do I simplify(expand) this Boolean expression?

Expression - (A OR B OR C OR D) AND (!B AND !D)
I know that with distributive property, it holds that (a OR b) AND (c OR d) = (a AND c) OR (a AND d) OR (b AND c) or (b AND d) but I'm not sure how it will work if the second group has an AND
Steps in the answer would help.
Something like this perhaps?
(A OR B OR C OR D) AND (!B AND !D)
= (A OR B OR C OR D) AND !(B OR D)
= ((A OR C) OR (B OR D)) AND !(B OR D)
= ((A OR C) AND !(B OR D)) OR ((B OR D) AND !(B OR D))
= (A OR C) AND !(B OR D) OR false
= (A OR C) AND !(B OR D)
That seems like it's going to be minimal since each variable appears once and there are no apparent contradictions or tautologies.

Boolean expression with four operands

How can I write a boolean expression which will be true if and only if there is one out of four operands is true? I need the most succinct possible way to write it.
Here's how I'd do it:
((A XOR B) XOR (C XOR D)) AND (NOT (A AND B)) AND (NOT (C AND D))
The first part
((A XOR B) XOR (C XOR D))
Works for all cases except three inputs being true, hence the second part.

Common Lisp function that unwraps a list to reveal the sequence of elements inside the list?

I want to apply the union function to the lists within a list. For example:
apply union to the lists inside this list: '((a b c) (a d))
Is there a function that "unwraps" a list, to reveal the sequence of elements inside the list? For example:
unwrapping this list '((a b c) (a d)) produces this sequence '(a b c) '(a d)
If I could do that, then I could apply the union function to the sequence.
What is the recommended idiom for taking the union of a sequence of lists contained within a list?
CL-USER 15 > (reduce #'union '((a b c) (a d)))
(D A B C)

boolean algebra simplification provided equation

i have this one
OM5= NOT ( A OR (B AND C)) OR D
i provided i photo of it.
http://i.stack.imgur.com/opS1I.png
I used different calcs that were online and all gave me this result
http://www.wolframalpha.com/input/?i=not+(a+or+b%26%26c)+or+d like the wolframalpha one!
But when i did it with my hand i had different results.
the result was NOT(A) AND ( NOT(B) OR NOT(C) OR D )
NOT ( A OR (B AND C)) OR D
= (NOT A AND NOT (B AND C)) OR D
= (NOT A AND (NOT B OR NOT C)) OR D
= (NOT A AND NOT B) OR (NOT A AND NOT C) OR D
That's it.

Convert function with only AND Boolean operations

I have some function like
(A and ( B or c)) or (D and E and (F or H or R or P )))
and I want to convert that function to function with only and operations (of course if possible)
I find that with DeMorgan's Laws can be done some kind of transformations but I didn't manage to conver this function any ideas ?
I know that function
!(A or B) is equal to function !A and !B
but I could not find the equal function to the one above
The function you mentioned:
!(A or B) = !A and !B
is the same as:
A or B = !(!A and !B)
So let's start by splitting your problem into two parts of ABC and DEFHRP.
(A and (B or C)) = (A and !(!B and !C))
(D and E and (F or H or R or P)) = (D and E and !(!F and !H and !R and !P))
Since these two parts are joined by an 'or', we can apply the equivalence again to get:
!(!(A and !(!B and !C)) and !(D and E and !(!F and !H and !R and !P)))
The key substitution you're looking for is A OR B => !(!A AND !B). Using this you can expand the expression.
a and (b or c)
is the same as
a and not (not b and not c)
You can test it here
And for the more complex one:
d and e and (f or h or r)
is the same as
d and e and not(not f and not h and not r)
which is tested here