aboutsummaryrefslogtreecommitdiff
path: root/doc/logic.md
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2021-07-07 19:59:57 -0400
committerMarshall Lochbaum <mwlochbaum@gmail.com>2021-07-07 22:20:25 -0400
commitdf6d6a0fa85c07c67eaa40a097953e3290f5d356 (patch)
treed68b9091fea51051bfd97e5cb4f3d33bdfe99fbf /doc/logic.md
parent00d29478d5a1b74c77643deef8f48699dacead3a (diff)
Continued editing and links
Diffstat (limited to 'doc/logic.md')
-rw-r--r--doc/logic.md14
1 files changed, 8 insertions, 6 deletions
diff --git a/doc/logic.md b/doc/logic.md
index 1e25fd57..8e7f935a 100644
--- a/doc/logic.md
+++ b/doc/logic.md
@@ -8,6 +8,8 @@ If the arguments are probabilities of independent events, then an extended funct
Both valences of `¬` are equivalent to the fork `1+-`. The dyadic valence, called "Span", computes the number of integers in the range from `𝕩` to `𝕨`, inclusive, when both arguments are integers and `𝕩≤𝕨` (note the reversed order, which is used for consistency with subtraction). This function has many uses, and in particular is relevant to the [Windows](windows.md) function.
+These functions are considered [arithmetic](arithmetic.md) functions and thus are [pervasive](arithmetic.md#pervasion).
+
## Definitions
We define:
@@ -22,7 +24,7 @@ Note that `¬⁼ ←→ ¬`, since when applying `¬` twice the first added 1 wi
## Examples
-We can form truth tables including the non-integer value one-half:
+We can form truth [tables](map.md#table) including the non-integer value one-half:
¬ 0‿0.5‿1
@@ -30,18 +32,18 @@ We can form truth tables including the non-integer value one-half:
∨⌜˜ 0‿0.5‿1
-As with logical And and Or, any value and 0 is 0, while any value or 1 is 1. The other boolean values give the identity elements for the two functions: 1 and any value gives that value, as does 0 or the value.
+As with logical And and Or, any value and 0 is 0, while any value or 1 is 1. The other boolean values give the identity values for the two functions: 1 and any value gives that value, as does 0 or the value.
## Why not GCD and LCM?
The main reason for omitting these functions is that they are complicated and, when applied to real or complex numbers, require a significant number of design decisions where there is no obvious choice (for example, whether to use comparison tolerance). On the other hand, these functions are fairly easy to implement, which allows the programmer to control the details, and also add functionality such as the extended GCD.
-A secondary reason is that the GCD falls short as an extension of Or, because its identity element 0 is not total. `0∨x`, for a real number `x`, is actually equal to `|x` and not `x`: for example, `0∨¯2` is `2` in APL. This means the identity `0∨x ←→ x` isn't reliable in APL.
+A secondary reason is that the GCD falls short as an extension of Or, because its identity value 0 is not total. `0∨x`, for a real number `x`, is actually equal to `|x` and not `x`: for example, `0∨¯2` is `2` in APL. This means the identity `0∨x ←→ x` isn't reliable in APL.
-## Identity elements
+## Identity values
-It's common to apply `∧´` or `∨´` to a list (checking whether all elements are true and whether any are true, respectively), and so it's important for extensions to And and Or to share their identity element. Minimum and Maximum do match And and Or when restricted to booleans, but they have different identity elements. It would be dangerous to use Maximum to check whether any element of a list is true because `>⌈´⟨⟩` yields `¯∞` instead of `0`—a bug waiting to happen. Always using `0` as a left argument to `⌈´` fixes this problem but requires more work from the programmer, making errors more likely.
+It's common to apply a [fold](fold.md) `∧´` or `∨´` to a list (checking whether all elements are true and whether any are true, respectively), and so it's important for extensions to And and Or to share their [identity](fold.md#identity-values) value. [Minimum and Maximum](arithmetic.md#additional-arithmetic) do match And and Or when restricted to booleans, but they have different identity values. It would be dangerous to use Maximum to check whether any element of a list is true because `⌈´⟨⟩` yields `¯∞` instead of `0`—a bug waiting to happen. To avoid this the programmer would have to use an initial value `𝕨` of `0`, which is easy to forget.
-It is easy to prove that the bilinear extensions have the identity elements we want. Of course `1∧x` is `1×x`, or `x`, and `0∨x` is `0×⌾¬x`, or `¬1׬x`, giving `¬¬x` or `x` again. Both functions are commutative, so these identities are double-sided.
+It's not hard to prove that the bilinear extensions have the identity values we want. Of course `1∧x` is `1×x`, or `x`, and `0∨x` is `0×⌾¬x`, or `¬1׬x`, giving `¬¬x` or `x` again. Both functions are commutative, so these values are identities on the right as well.
Other logical identities do not necessarily hold. For example, in boolean logic And distributes over Or and vice-versa: `a∧b∨c ←→ (a∧b)∨(a∧c)`. But substituting `×` for `∧` and `+-×` for `∨` we find that the left hand side is `(a×b)+(a×c)+(a×b×c)` while the right gives `(a×b)+(a×c)+(a×b×a×c)`. These are equivalent for arbitrary `b` and `c` only if `a=a×a`, that is, `a` is 0 or 1. In terms of probabilities the difference when `a` is not boolean is caused by failure of independence. On the left hand side, the two arguments of every logical function are independent. On the right hand side, each pair of arguments to `∧` are independent, but the two arguments to `∨`, `a∧b` and `a∧c`, are not. The relationship between these arguments means that logical equivalences no longer apply.