boolean-logic

Implementing 5-variable function using multiplexers

If I have a 5-variable function (below) and I want to implement it using a multiplexer, how would I do that (using the minimum possible multiplexer): f(A,B,C,D,E) = A + C'D + BD' + B'D + B'CE This is homework, so don't provide a solution, just a guidance of how that works. Thanks! ...

I'm trying to figure how to flatten a parenthesized boolean expression into a set of ordered expressions that are logically the same.

So let's say I've got an expression like this: ((((e1) or (e2)) and (e3 or (e5 and e6)) and (e7)) or (e8)) I need to end up with a list of expressions (e1, e2, e3 etc) followed by and/or operators so that evaluating the list from left to right yields the same logical boolean answer. ie e1 or e2 and e5 and e6 or e3 and e7 or e8. But th...

Boolean Logic and Truth Tables Explanation

I'm needing to create a truth table, and I really need to find a resource to explain how it works. I'll give an example of a problem. I have to create a truth table based on this: A*(B+A*B)=A*B So the truth table looks something like: 0 0 0 1 1 0 1 1 for A*(B+A*B)=A*B How do I even begin to solve this? Are there any good res...

Boolean Algebra Simplification

Need help have no idea the thought process in doing this kind of simplification. ! - Denotes NOT Lets say I have !((A+B) * (A+!B)) I need to simplify that using all rules except absortion. I know it is A * !B + !A * B but I need to know the process to get there. What is a good place to start. I do several different things but I never co...

How do I turn this question into a boolean logic problem?

"If you can press a button to get $1M and a random person dies somewhere in the world would you press the button?" A = press button B = get $1M C = random person dies Here is what I think it should be: If A, then B AND c According to the original statement is it: (If A, then B) AND C or If A, then (B AND C) ...

How do search engines conduct 'AND' operation?

Consider the following search results: Google for 'David' - 591 millions hits in 0.28 sec Google for 'John' - 785 millions hits in 0.18 sec OK. Pages are indexed, it only needs to look up the count and the first few items in the index table, so speed is understandable. Now consider the following search with AND operation: Goog...

More than operator in Boolean Logic (Logic gates)

Basically I have 2 unsigned 8-bit binary numbers and I need to use Boolean logic to find out which is larger and I can't for the life of me figure out where to start. Using Logic gates... Obivously I have to analyse each bit and find out which one is larger but how do I bring it all together? Say I had x and y and wanted to return true...

C boolean logic

I have been trying some programs in the C Language and come across to this... #include<stdio.h> int main() { int j=3,k; k=!5&&j; printf("%d",k); return 0; } can anyone figure out what is the problem in this if i compile the program i will result to 0 and when i tried the same code in c# public void logic() { ...

Dynamically evaluating simple boolean logic in Python

I've got some dynamically-generated boolean logic expressions, like: (A or B) and (C or D) A or (A and B) A empty - evaluates to True The placeholders get replaced with booleans. Should I, Convert this information to a Python expression like True or (True or False) and eval it? Create a binary tree where a node is either a bool or ...

If I XOR 2 numbers, do I only get identical results if the numbers are the same?

For example, suppose I have x XOR y = y XOR x = z. Is it possible to have something like a XOR b = z? ...

How do "and" and "or" work when combined in one statement?

For some reason this function confused me: def protocol(port): return port == "443" and "https://" or "http://" Can somebody explain the order of what's happening behind the scenes to make this work the way it does. I understood it as this until I tried it: Either A) def protocol(port): if port == "443": if bool("ht...

java equivalent of Delphi NOT

In Delphi I can do the following with a boolean variable: If NOT bValue then begin //do some stuff end; Does the equivalent in Java use the !? If !(bValue) { //do some stuff } ...

Rewrite probabilities as boolean algebra

I'm given three binary random variables: X, Y, and Z. I'm also given the following: P(Z | X) P(Z | Y) P(X) P(Y) I'm then supposed to determine whether or not it is possible to find P(Z | Y, X). I've tried rewriting the solution in the form of Bayes' Theorem and have gotten nowhere. Given that these are boolean random variables, is i...

Boolean algebra simplification

I need to reduce this boolean expression to its simplest form. Its given that the simplest form contains 3 terms and 7 literals. The expression is: x'yz + w'x'z + x'y + wxy + w'y'z We tried this in class, and even out recitation teacher could not figure it out. Any help would be appreciated. ...

How to convert "0" and "1" to false and true

I have a method which is connecting to a database via Odbc. The stored procedure which I'm calling has a return value which from the database side is a 'Char'. Right now I'm grabbing that return value as a string and using it in a simple if statement. I really don't like the idea of comparing a string like this when only two values can ...

P implies Q, how to read in english

how to read P implies Q in classical logic? example : Distributivity: Ka(X->Y) -> (KaX -> KaY) This is modal logic which uses classical logic rules. KaX : a knows the that X is true. I m curious about how to read implication in english? if then else? Edit : in Modal Logic, Ka becomes Box, well it s boxed shape sign, that symb...

Static analysis of multiple if statements (conditions)

I have code similar to: if conditionA(x, y, z) then doA() else if conditionB(x, y, z) then doB() ... else if conditionZ(x, y, z) then doZ() else throw ShouldNeverHappenException I would like to validate two things (using static analysis): If all conditions conditionA, conditionB, ..., conditionZ are mutually exclusive (i.e. it ...

Database Table of Boolean Values

What's the best method of storing a large number of booleans in a database table? Should I create a column for each boolean value or is there a more optimal method? Employee Table IsHardWorking IsEfficient IsCrazy IsOverworked IsUnderpaid ...etc. ...

Optimize conditional operators branching in C#

Hello. I have next code: return this.AllowChooseAny.Value ? radioSpecific.Checked ? UserManager.CurrentUser.IsClient ? txtSubject.Text : subjectDropDownList.SelectedItem.Text : String.Empty : UserManager.CurrentUser.IsClient ? txtSubject.Text : subjectDropDownList.SelectedItem.Text; or in less complex...

Null-coalescing operator and operator && in C#

Is it possible to use together any way operator ?? and operator && in next case: bool? Any { get { var any = this.ViewState["any"] as bool?; return any.HasValue ? any.Value && this.SomeBool : any; } } This means next: if any is null then this.Any.HasValue return false if any has value, then it returns value cons...