boolean-expression,simplification,boolean-algebra , Which laws simplify this boolean expression?

## Question:

Tag: boolean-expression,simplification,boolean-algebra

Which laws do I need to use to simplify

``````!X + (!Y + !Z)*(Y + Z)
``````

to

``````!X + (Y*!Z) + (!Y*Z)
``````

Answer:

You can first start by distributivity of multiplication over addition:

``````!X + (!Y + !Z)*(Y + Z) = !X + !Y*Y + !Z*Y + !Y*Z + !Z*Z
``````

Then, we can use complementation to remove elements of the form `!p*p`:

``````= !X + 0 + !Z*Y + !Y*Z + 0
``````

And finally remove the `0` as they are `+`'s neutral.

# Related:

## Boolean function confusion

boolean-expression
I'm trying to do the Kmap for F(A,B,C,D)= A’B’C’D’+AC’D’+B’CD’+A’BCD+BC’D . I'm getting a little confused because not all the variable groupings have the same number of variables. some have 4 and some have 3. is this equivalent to F(A,B,C,D) = F(0,2,4,5,7) ? I don't know if you have to do...

## I have a language where I need to determine if my flow control statement predicates are tautologies or contradictions

compiler-construction,compiler-errors,boolean-expression
Hello I'm working on a domain specific language with my project group. We want to report to the language user if the predicate in for example if(predicate) or while(predicate) are always true or always false. The logic operators implemented on the language are AND, OR, NEGATION as well as the...

## How to express a condition in a Mongo Pipeline with multiple \$and's on the same level

php,mongodb,aggregation,boolean-expression
My problem is that I need to express a condition in a Mongo Aggregation pipeline in the format ((A&B)||(C&D)) which when you write it out in the format that Mongo writes it's boolean expressions in yields {\$or: {\$and: {A, B}, \$and: {C ,D}}. The problem with this is that you...

## What's wrong with order for not() in python?

python,operators,boolean-expression
What's wrong with using not() in python?. I tried this In : not(1) + 1 Out: False And it worked fine. But after readjusting it, In : 1 + not(1) Out: SyntaxError: invalid syntax It gives an error. How does the order matters?...

## Using a BOOLEAN expression in a #define value

ios,define,boolean-expression
I usually define my constants like so #define kIamAconstant and I have my api endpoint in a constant like this. Now my project requires me to have a toggle that switches this between two different end points for testing. I have a 10s of thousands of lines of code, and...

## Understanding a Boolean conjunction statement in Rails method

ruby-on-rails,ruby,boolean-expression
This might be a trivial point, but I don't understand it and it bothers me. Going through the Ruby on Rails Tutorial by Michael Hartl, there is this method definition : def create user = User.find_by(email: params[:session][:email].downcase) if user && user.authenticate(params[:session][:password]) log_in user redirect_to user else flash.now[:danger] = "Invalid email/password...

## Which laws simplify this boolean expression?

boolean-expression,simplification,boolean-algebra
Which laws do I need to use to simplify !X + (!Y + !Z)*(Y + Z) to !X + (Y*!Z) + (!Y*Z) ...

## How to prevent MariaDB from simplfiying logical expressions

view,mariadb,simplification
I'm having a very weird problem with MariaDB 10, it simplify automaticaly some logical expression !! here's an example CREATE VIEW test AS SELECT 1 FROM test_table WHERE NOT (1 < 2 OR 3 > 4); SHOW CREATE VIEW test; CREATE ALGORITHM = UNDEFINED DEFINER =`root`@`localhost` SQL SECURITY DEFINER VIEW...

## Double compare in JavaScript looks weird [duplicate]

javascript,boolean,compare,boolean-expression
This question already has an answer here: chaining double equals == returns false 3 answers Let's var a = "first", b = "second", c = "first";. Expression a == c returns true, (of course!); a == c is true too. Then why does a == a == c return...

## switch between true and false state

jquery,boolean-logic,boolean-expression
I have an object representing a player and let us say 2 players //create a player object function player(name,state,score) { this.name = name; this.state = state; this.score = score; } var players = [ new player('player1',true,0), new player('player2',false,0) ]; so I want the players to make a move one after...

## SSN validation using strings

java,string,validation,io,boolean-expression
I'm supposed to write a program that reads in a SSN as a string, including dashes, like DDD-DD-DDDD, where 'D' is a digit. If it's valid, it prints "valid ssn" and the opposite if it isn't valid. I'm supposed to have four methods: main, public static boolean validSSN(String s), public...

## How to create a boolean local variable as a result of MouseEvent?

java,mouseevent,boolean-expression
I'm just starting to learn Java and I'm trying to correctly initialise 4 variables that come from a MouseEvent. I understand how to retrieve a click position, but I don't know how to create a boolean local variable, leftClicked, and initialize it to true if the left mouse button is...

## Simplify coding trycast vb.net

vb.net,simplify,simplification
Consider I have some models as follow: black, green, blue, red. I have a function which receive an object and I would like to trycast the object to appropriate model. Now I have the code like this: Public Sub SetData(ByVal obj As Object) If TryCast(obj, black) IsNot Nothing Then Dim...

## Boolean expressions - getting mixed up with AND, OR logical operators and how they work

javascript,boolean-expression
I have to convert a number to comma format. E.g 12345 => 12,345. I have my solution : function convert(n) { n = n.toString(); var result = ''; var count = 0, var idx = n.length - 1; while (r = n[idx]) { count++; result = ((count % 3 ==...