Is there a way to simplify redundant conditionals?


For example if I’ve this:

if a == false then return true else if a == true and b == false return true else if a == true and b == true then return false 

can be simplified to

if a == false || b == false then return true return false; 

Truth Table would look like this:

F T = T F F = T T F = T T T = F 

I want to come up with a solution that can get arbitrarily big conditional but condense it to the minimum state and get rid of cases which will never occur.

I’d imagine one way would be to generate a truth table and work your way up from there, another would be to find and combine combos with similar out comes and come up with a pattern that would keep the existing truth table intact.