diff options
author | Marvin Borner | 2023-10-19 13:29:38 +0200 |
---|---|---|
committer | Marvin Borner | 2023-10-19 13:29:38 +0200 |
commit | bafbcc6e5f8a9aa1e4d8cdc27b330b07046b7ef8 (patch) | |
tree | 6bf710f018ec6ed1af0ab4b3c81a1651b70cee22 /std/Logic.bruijn | |
parent | 0546c892748c77595fbd10357ede60c53a745be4 (diff) |
Optimized boolean logic
Diffstat (limited to 'std/Logic.bruijn')
-rw-r--r-- | std/Logic.bruijn | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/std/Logic.bruijn b/std/Logic.bruijn index e6f205c..b16595c 100644 --- a/std/Logic.bruijn +++ b/std/Logic.bruijn @@ -10,7 +10,7 @@ false ki ⧗ Boolean # inverts boolean value # equivalent of [0 ⇒ false] -not! [0 false true] ⧗ Boolean → Boolean +not! c ⧗ Boolean → Boolean ¬‣ not! @@ -18,7 +18,7 @@ not! [0 false true] ⧗ Boolean → Boolean :test (¬false) (true) # true if both args are true -and? [[1 0 false]] ⧗ Boolean → Boolean → Boolean +and? [[0 1 0]] ⧗ Boolean → Boolean → Boolean …⋀?… and? @@ -36,7 +36,7 @@ nand? [[1 0 1 false true]] ⧗ Boolean → Boolean → Boolean :test (nand? false false) (true) # true if one of the args is true -or? [[1 true 0]] ⧗ Boolean → Boolean → Boolean +or? m ⧗ Boolean → Boolean → Boolean …⋁?… or? @@ -54,7 +54,7 @@ nor? [[1 1 0 false true]] ⧗ Boolean → Boolean → Boolean :test (nor? false false) (true) # true if args are not same bools -xor? [[1 ¬0 0]] ⧗ Boolean → Boolean → Boolean +xor? [[0 (1 false 0) 1]] ⧗ Boolean → Boolean → Boolean :test (xor? true true) (false) :test (xor? true false) (true) @@ -62,7 +62,7 @@ xor? [[1 ¬0 0]] ⧗ Boolean → Boolean → Boolean :test (xor? false false) (false) # true if both args are same bools -xnor? [[1 0 ¬0]] ⧗ Boolean → Boolean → Boolean +xnor? [[0 1 (1 0 true)]] ⧗ Boolean → Boolean → Boolean :test (xnor? true true) (true) :test (xnor? true false) (false) @@ -82,7 +82,7 @@ if [[[2 1 0]]] ⧗ Boolean → a → b → c :test (false ? true : false) (false) # mathematical implies definition -implies [[¬1 ⋁? 0]] ⧗ Boolean → Boolean → Boolean +implies [[1 0 true]] ⧗ Boolean → Boolean → Boolean …⇒?… implies @@ -92,7 +92,7 @@ implies [[¬1 ⋁? 0]] ⧗ Boolean → Boolean → Boolean :test (false ⇒? false) (true) # mathematical iff (if and only if) definition -iff [[(1 ⇒? 0) ⋀? (0 ⇒? 1)]] ⧗ Boolean → Boolean → Boolean +iff xnor? ⧗ Boolean → Boolean → Boolean …⇔?… iff |