diff options
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/inferred.md | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/spec/inferred.md b/spec/inferred.md index 5ed454b7..707d70ca 100644 --- a/spec/inferred.md +++ b/spec/inferred.md @@ -62,6 +62,8 @@ Fill elements of iteration modifiers such as `Β¨β` are not specified. It is re The Undo 1-modifier `βΌ`, given an operand `π½` and argument `π©`, and possibly a left argument `π¨`, finds a value `y` such that `π©β‘π¨π½y`, that is, an element of the pre-image of `π©` under `π½` or `π¨π½β’`. Thus it satisfies the constraint `π© β‘ π¨π½π¨π½βΌπ©` (`π¨π½βΌβ’` is a *right inverse* of `π¨π½β’`) provided `π½βΌ` and `π½` both complete without error. `π½βΌ` should of course give an error if no inverse element exists, and can also fail if no inverse can be found. It is also preferred for `π½βΌ` to give an error if there are many choices of inverse with no clear way to choose one of them: for example, `0βΏ0βm` returns the diagonal of matrix `m`; `0βΏ0ββΌ2βΏ3` requires values to be chosen for the off-diagonal elements in its result. It is better to give an error, encouraging the programmer to use a fully-specified approach like `2βΏ3βΎ(0βΏ0βΈβ)` applied to a matrix of initial elements, than to return a result that could be very different from other implementations. +If a value `π©` isn't in the range of `π½`, then no result satisfies the rule for `π½βΌπ©`. As `π½βΌπ©` would then always give an error by the above rules, a BQN implementation with extensions could define it in any way. However, two such extensions are specified: `FβΌβΌ` and `Fβ(-n)βΌ` are extended to the full domain of `F` and `/βΌ` to any list of natural numbers, as noted below. + When working with limited-precision numbers, it may be difficult or impossible to exactly invert the operand function. Instead, it is generally acceptable to perform a computation that, if done with unlimited precision, would exactly invert `π½` computed with unlimited precision. This principle is the basis for the numeric inverses specified below. It is also acceptable to find an inverse by numeric methods, provided that the error in the inverse value found relative to an unlimited-precision inverse can be kept close to the inherent error in the implementation's number format. Regardless of which cases for Undo are supported, the result of a call, and whether it is an error, must depend only on the values of the inputs `π½`, `π©`, and (if present) `π¨`. @@ -88,7 +90,7 @@ Unlike these inverses, the logarithm functionβbase *e* for `ββΌπ©` and ba |-----|-------|------- | `β` | `Log` | `Γ·ΛβLog` -The following structural functions have unique inverses, except in a few cases. Dyadic `β` with repeated axes is excluded, and monadic `<` can only be inverted on a rank-0 array. Dyadic `β£` is invertible only if the arguments match, and in this case any return value is valid, but in BQN the shared argument value is returned. For `/βΌ` the argument must be a list of non-descending natural numbers, and the result's fill element is 0. +The following structural functions have unique inverses, except in a few cases. Dyadic `β` with repeated axes is excluded, and monadic `<` can only be inverted on a rank-0 array. Dyadic `β£` is invertible only if the arguments match, and in this case any return value is valid, but in BQN the shared argument value is returned. For `/βΌ` the argument must be a list of natural numbers (it's extended to handle any such list even though the range consists of non-descending ones), and the result's fill element is 0. | Fn | 1 | 2 |-----|---------------------|------- @@ -148,9 +150,9 @@ Inverses of other modifiers and derived functions or modifiers obtained from the | `F G` | | | `Β·F G` | | | `β` | `{πΎβΌ(πΎπ¨)π½βΌπ©}` | -| `βΌ` | `{rβπ½π©β!π©β‘π½βΌrβr}` | +| `βΌ` | `{π½}` | Extended: no result check | `βΎ` | `{π½βΌβΎπΎ}` | Verify result for computational Under -| `βn` | `β(-n)` | Atomic number `n` +| `βn` | `β(-n)` | Atomic number `n`; no check, like `βΌ` | `β` | `{(π½βΌ)β(πΎβΌ)}` | | `βΈ` | `{π½βΈ(πΎβΌ)}` | Dyadic case or constant `π½` only | `β` | `{πΎβΌπ½βΌ}` | Dyadic case |
