I am trying to create a 2-input NOR Gate only from XOR and AND Gates. however I am stuck. The output must be NOT X AND NOT Y as the definition of a NOR GATE but I can not seem to understand how to get it.
I think this will work.
(A XOR 1) AND (B XOR 1)
Related
When you simplify something down into these two, is there really any difference between?
For example:
( (B'C)' * (B'D')' )'
Is this and NAND only? If so, can it be converted to AND and NOT only? Or vice-versa? I'm confused on the difference between the two.
Your formula:
( (B'C)' * (B'D')' )'
Assume ' is negation and * and juxtaposition are used for conjunction; disjunction is not shown but would be denoted +. Let us rewrite the formula using not and and instead:
not (not (not B and C) and not (not B and not D))
Let us also indicate which nots go with which ands:
not (not (not B and C) and not (not B and not D))
^1 ^2 ^2 ^1 ^3 ^3
We can therefore eliminate three nots and replace the corresponding ands with three nands:
(not B nand C) nand (not B nand not D)
We see right away that the original formula was not expressed using only nands since eliminating pairs of nots and ands using the definition of nand did not eliminate non-nand operators.
However, the original formula does consist only of and and not. Because any formula can be written using nands only, this one can. The lazy way is to just use not x = x nand x three times to remove each of the remaining nots.
I'm working on some assignment and got to build few gates starting with only NAND gate.
At this moment I have already following: AND, NOT, NAND.
To build AND and NOT wasn't too diffucult since it was quite obvious how to manipulate NAND to get expected results just by looking at its truth table. However I already had feeling that I'm doing things not in the right way. Now I stuck on building OR gate since I'm not able to find any relationship when just looking in truth table.
I do not need just an answer rather explaination and methodology that I could apply in future when building other gates as well.
Thanks.
You have:
a + b
rewrite to
~~(a + b) // Invert twice
then use De Morgan's law (i.e. ~(X + Y) = ~X * ~Y ) and rewrite to
~(~a * ~b)
Now you can use the NOT you already have on both a and b and then followed by a NAND
Like:
BTW - free hand drawing in paint ain't easy :-)
Obviously ~X = X nand X. Now using De Morgan duality, we have
X or Y = ~(~X and ~Y) = (X nand X) nand (Y nand Y)
I've been working on a problem and hope someone can help me with this (probably this has already been studied, I don't know).
For a given a and to numbers m and n, are there any special conditions for the equality
(a (mod m))(mod n)=(a (mod n))(mod m)
to hold? I've been trying to come up with something, but until now I have no clue. Can anyone please help me with this?
Thanks!!
Yes there is. Without loss of generality you can assume 'n smaller than m' (if they are the same the equality holds). Hence (a (mod n))(mod m)= a (mod n). Now the equality holds iff 'a=n*m*x+y' with 'x' and 'y' are natural numbers and 'y smaller than m' holds, meaning '(int) a/m' is a multiple of 'n'.
I am trying to understand with boolean algebra how using 4 NAND Gates can be equivalen to 1 XOR gate.
If we look at this picture from wikipedia http://en.wikipedia.org/wiki/XOR_gate#Alternatives
There is a schematic of the gate.
This is the large expression I came up with to express the schematic. Perhaps it is wrong and that may be my issue? But still I cannot see how to transform the equation into the XOR expression I expect.
I have: !X!Y + X(!X!Y) + Y(!X!Y) + XY(!X!Y)
I know XOR logic looks like this: X!Y + !XY.
Can anyone clear up my confusion?
Your translation of the schematic on Wikipedia is a little bit off. I translated it into
!(!(A!(AB))!(B!(AB)))
Notice that !(XY) and !X!Y are different and that the schematic does not have any or gates (so no + operators). From there we can simplify using various boolean logic:
(!(!(A!(AB))) + !(!(B!(AB))))
(A!(AB) + B!(AB))
(A(!A + !B) + B(!A + !B))
(A!B + B!A)
I wrote an answer to what I thought was a quite interesting question, but unfortunately the question was deleted by its author before I could post. I'm reposting a summary of the question and my answer here in case it might be of use to anyone else.
Suppose I have a SAT solver that, given a Boolean formula in conjunctive normal form, returns either a solution (a variable assignment that satisfies the formula) or the information that the problem is unsatisfiable.
Can I use this solver to find all the solutions?
There is definitely a way to use the SAT solver you described to find all the solutions of a SAT problem, although it may not be the most efficient way.
Just use the solver to find a solution to your original problem, add a clause that does nothing except rule out the solution you just found, use the solver to find a solution to the new problem, and so forth. Keep going until you get a problem that's unsatisfiable.
For example, suppose you want to satisfy (X or Y) and (X or Z). There are five solutions:
Four with X true, Y and Z arbitrary.
One with X false, Y and Z true.
So you run your solver, and let's say it gives you the solution (X, Y, Z) = (T, F, F). You can rule out this solution---and only this solution---with the constraint
not (X and (not Y) and (not Z))
This constraint can be rewritten as the clause
(not X) or Y or Z
So now you can run your solver on the new problem
(X or Y) and (X or Z) and ((not X) or Y or Z)
and so forth.
Like I said, this is a way to do what you want, but it probably isn't the most efficient way. When your SAT solver is looking for a solution, it learns a lot about the problem, but it doesn't return all that information to you---it just gives you the solution it found. When you run the solver again, it has to re-learn all the information that was thrown away.
Sure it can. When MiniSat[1] finds a solution
s SATISFIABLE
v 1 2 -3 0
(solution 1=True, 2=True, 3=False) then you have to put into the original CNF[2] a clause that bans this solution:
-1 -2 3 0
(which means, either 1 or 2 must be False or 3 must be True). Then you solve again. You do this until the solver returns UNSAT i.e. that there are no more solutions to the problem. You will insert one clause for each iteration, and each clause will have the same format as the solution except that it's all inverted and has a 0 at the end
It's much faster to do this using the C++ interface of MiniSat, as it can then save intermediate data and the iterations will be faster.
[1] http://minisat.se/
[2] http://fairmut3x.wordpress.com/2011/07/29/cnf-conjunctive-normal-form-dimacs-format-explained/