larzlogic
Boolean logic you can see.
AND, OR and NOT are the bedrock of computing but are usually taught abstractly. larzlogic evaluates boolean expressions written in plain words (A and (B or not C)) and generates the full truth table, so you can see exactly when an expression is true. Hand-written parser, no eval.
larzscript pkg install logic
What you get
- Evaluate AND/OR/NOT/XOR expressions
- Generate full truth tables
- List an expression's variables
- Pairs with larzbits
Try it
import "logic" as logic
print(logic.evaluate("A and (B or not C)", {"A": true, "B": false, "C": false}))
print(logic.variables("A and (B or not C)"))
print(logic.truth_table_str("A and B"))Output
true [A, B, C] A | B | A and B --+---+-------- F | F | F F | T | F T | F | F T | T | T
Why it's in the Larz Stack
larzlogic is a real Larzscript package (larzscript pkg install logic) - money-native, zero dependencies, the same language as the rest of the estate, not a separate Python runtime. It composes with the rest of the Larz Stack and the Larz framework.