diff options
| author | Marshall Lochbaum <mwlochbaum@gmail.com> | 2021-12-12 09:19:08 -0500 |
|---|---|---|
| committer | Marshall Lochbaum <mwlochbaum@gmail.com> | 2021-12-12 09:19:08 -0500 |
| commit | abfa39c6fc52e9d58e0c205977af2073eaf05c10 (patch) | |
| tree | 4427984497ad6f943b3408e462b578238c93ff76 /docs/spec/inferred.html | |
| parent | 15a04da04ed5b803686fa9b49e407d9b90ce184e (diff) | |
Special case extensions to remove checks from /⁼ and F⁼⁼
Diffstat (limited to 'docs/spec/inferred.html')
| -rw-r--r-- | docs/spec/inferred.html | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/docs/spec/inferred.html b/docs/spec/inferred.html index a221ede0..fd247c65 100644 --- a/docs/spec/inferred.html +++ b/docs/spec/inferred.html @@ -122,6 +122,7 @@ <p>Fill elements of iteration modifiers such as <code><span class='Modifier'>¨⌜</span></code> are not specified. It is reasonable to define the fill element of <code><span class='Function'>𝔽</span><span class='Modifier'>⌜</span></code> or <code><span class='Function'>𝔽</span><span class='Modifier'>¨</span></code> to be <code><span class='Function'>𝔽</span></code> applied to the fill elements of the arguments. Regardless of definition, computing the fill element cannot cause side effects or an error.</p> <h2 id="undo"><a class="header" href="#undo">Undo</a></h2> <p>The Undo 1-modifier <code><span class='Modifier'>⁼</span></code>, given an operand <code><span class='Function'>𝔽</span></code> and argument <code><span class='Value'>𝕩</span></code>, and possibly a left argument <code><span class='Value'>𝕨</span></code>, finds a value <code><span class='Value'>y</span></code> such that <code><span class='Value'>𝕩</span><span class='Function'>≡</span><span class='Value'>𝕨</span><span class='Function'>𝔽</span><span class='Value'>y</span></code>, that is, an element of the pre-image of <code><span class='Value'>𝕩</span></code> under <code><span class='Function'>𝔽</span></code> or <code><span class='Value'>𝕨</span><span class='Function'>𝔽⊢</span></code>. Thus it satisfies the constraint <code><span class='Value'>𝕩</span> <span class='Function'>≡</span> <span class='Value'>𝕨</span><span class='Function'>𝔽</span><span class='Value'>𝕨</span><span class='Function'>𝔽</span><span class='Modifier'>⁼</span><span class='Value'>𝕩</span></code> (<code><span class='Value'>𝕨</span><span class='Function'>𝔽</span><span class='Modifier'>⁼</span><span class='Function'>⊢</span></code> is a <em>right inverse</em> of <code><span class='Value'>𝕨</span><span class='Function'>𝔽⊢</span></code>) provided <code><span class='Function'>𝔽</span><span class='Modifier'>⁼</span></code> and <code><span class='Function'>𝔽</span></code> both complete without error. <code><span class='Function'>𝔽</span><span class='Modifier'>⁼</span></code> 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 <code><span class='Function'>𝔽</span><span class='Modifier'>⁼</span></code> to give an error if there are many choices of inverse with no clear way to choose one of them: for example, <code><span class='Number'>0</span><span class='Ligature'>‿</span><span class='Number'>0</span><span class='Function'>⍉</span><span class='Value'>m</span></code> returns the diagonal of matrix <code><span class='Value'>m</span></code>; <code><span class='Number'>0</span><span class='Ligature'>‿</span><span class='Number'>0</span><span class='Function'>⍉</span><span class='Modifier'>⁼</span><span class='Number'>2</span><span class='Ligature'>‿</span><span class='Number'>3</span></code> 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 <code><span class='Number'>2</span><span class='Ligature'>‿</span><span class='Number'>3</span><span class='Modifier2'>⌾</span><span class='Paren'>(</span><span class='Number'>0</span><span class='Ligature'>‿</span><span class='Number'>0</span><span class='Modifier2'>⊸</span><span class='Function'>⍉</span><span class='Paren'>)</span></code> applied to a matrix of initial elements, than to return a result that could be very different from other implementations.</p> +<p>If a value <code><span class='Value'>𝕩</span></code> isn't in the range of <code><span class='Function'>𝔽</span></code>, then no result satisfies the rule for <code><span class='Function'>𝔽</span><span class='Modifier'>⁼</span><span class='Value'>𝕩</span></code>. As <code><span class='Function'>𝔽</span><span class='Modifier'>⁼</span><span class='Value'>𝕩</span></code> 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: <code><span class='Function'>F</span><span class='Modifier'>⁼⁼</span></code> and <code><span class='Function'>F</span><span class='Modifier2'>⍟</span><span class='Paren'>(</span><span class='Function'>-</span><span class='Value'>n</span><span class='Paren'>)</span><span class='Modifier'>⁼</span></code> are extended to the full domain of <code><span class='Function'>F</span></code> and <code><span class='Function'>/</span><span class='Modifier'>⁼</span></code> to any list of natural numbers, as noted below.</p> <p>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 <code><span class='Function'>𝔽</span></code> 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.</p> <p>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 <code><span class='Function'>𝔽</span></code>, <code><span class='Value'>𝕩</span></code>, and (if present) <code><span class='Value'>𝕨</span></code>.</p> <h3 id="required-functions"><a class="header" href="#required-functions">Required functions</a></h3> @@ -190,7 +191,7 @@ </tr> </tbody> </table> -<p>The following structural functions have unique inverses, except in a few cases. Dyadic <code><span class='Function'>⍉</span></code> with repeated axes is excluded, and monadic <code><span class='Function'><</span></code> can only be inverted on a rank-0 array. Dyadic <code><span class='Function'>⊣</span></code> 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 <code><span class='Function'>/</span><span class='Modifier'>⁼</span></code> the argument must be a list of non-descending natural numbers, and the result's fill element is 0.</p> +<p>The following structural functions have unique inverses, except in a few cases. Dyadic <code><span class='Function'>⍉</span></code> with repeated axes is excluded, and monadic <code><span class='Function'><</span></code> can only be inverted on a rank-0 array. Dyadic <code><span class='Function'>⊣</span></code> 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 <code><span class='Function'>/</span><span class='Modifier'>⁼</span></code> 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.</p> <table> <thead> <tr> @@ -410,8 +411,8 @@ </tr> <tr> <td><code><span class='Modifier'>⁼</span></code></td> -<td><code><span class='Brace'>{</span><span class='Value'>r</span><span class='Gets'>←</span><span class='Function'>𝔽</span><span class='Value'>𝕩</span><span class='Separator'>⋄</span><span class='Function'>!</span><span class='Value'>𝕩</span><span class='Function'>≡𝔽</span><span class='Modifier'>⁼</span><span class='Value'>r</span><span class='Separator'>⋄</span><span class='Value'>r</span><span class='Brace'>}</span></code></td> -<td></td> +<td><code><span class='Brace'>{</span><span class='Function'>𝔽</span><span class='Brace'>}</span></code></td> +<td>Extended: no result check</td> </tr> <tr> <td><code><span class='Modifier2'>⌾</span></code></td> @@ -421,7 +422,7 @@ <tr> <td><code><span class='Modifier2'>⍟</span><span class='Value'>n</span></code></td> <td><code><span class='Modifier2'>⍟</span><span class='Paren'>(</span><span class='Function'>-</span><span class='Value'>n</span><span class='Paren'>)</span></code></td> -<td>Atomic number <code><span class='Value'>n</span></code></td> +<td>Atomic number <code><span class='Value'>n</span></code>; no check, like <code><span class='Modifier'>⁼</span></code></td> </tr> <tr> <td><code><span class='Modifier2'>⊘</span></code></td> |
