Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Boolean expression simplifier #1057

Open
TrangOul opened this issue Feb 16, 2024 · 0 comments
Open

Boolean expression simplifier #1057

TrangOul opened this issue Feb 16, 2024 · 0 comments
Labels
feature Feature / Tool request or idea under consideration We like the idea / feedback but don't commit to it yet.

Comments

@TrangOul
Copy link

TrangOul commented Feb 16, 2024

What feature or new tool do you think should be added to DevToys?

A Boolean expression calculator which can simplify the given logical expression.

Capability Priority
Accept a Boolean expression in programming (&&, ||, !) or text (AND, OR, NOT) notation. Must
Support NAND and NOR operators (as logically complete). Should
Support operator (A AND B) and function (Excel-like) notation (AND(A, B)).
Allow longer variable names (has_access, isAdmin), so it's possible to paste the code directly (and use the same var names in the output).
Output CNF and DNF forms, as well as NAND and NOR (see above).
Generate a truth table with all the variables and the result (2^vars rows).
Support additional notations for operators (such as math: , , ¬/~). Could
Support additional notations for Boolean literals (true/false, T/F, 1/0, /) in the truth table.
Output AND+NOT and OR+NOT forms.
Support prefix (Polish) and postfix (reverse Polish) notation.
Draw a Venn diagram (for small numbers of variables - intersecting circles can be used only with up to 3 vars; can be slighly extended with ellipses).
Support additional logical operators (XOR, IMPLIES and so on) - both in input and output (if chosen).

Why do you think this is needed?

Often used by programmers (or actually not used - hence inefficient code and ifs spanning multiple lines).

Solution/Idea

Input:
(a && b) || (a && c) || (!b && !c) (programming notation)
(a AND b) OR (a AND c) OR (NOT b AND NOT c) (text notation)

Output:
a || (!b && !c))
a OR (NOT b AND NOT c)

Truth table

a b c result
0 0 0 1
0 0 1 0
0 1 0 0
0 1 1 0
1 0 0 1
1 0 1 1
1 1 0 1
1 1 1 1

Venn diagram:
image

Comments

Available as an online tool: Wolfram Alpha, dCode - it'd be handy to have such a tool offline.

@TrangOul TrangOul added feature Feature / Tool request or idea untriaged labels Feb 16, 2024
@veler veler added under consideration We like the idea / feedback but don't commit to it yet. and removed untriaged labels Feb 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Feature / Tool request or idea under consideration We like the idea / feedback but don't commit to it yet.
Projects
None yet
Development

No branches or pull requests

2 participants