From abfa39c6fc52e9d58e0c205977af2073eaf05c10 Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Sun, 12 Dec 2021 09:19:08 -0500 Subject: =?UTF-8?q?Special=20case=20extensions=20to=20remove=20checks=20fr?= =?UTF-8?q?om=20/=E2=81=BC=20and=20F=E2=81=BC=E2=81=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/spec/inferred.html | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'docs/spec') 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 @@

Fill elements of iteration modifiers such as ยจโŒœ are not specified. It is reasonable to define the fill element of ๐”ฝโŒœ or ๐”ฝยจ to be ๐”ฝ applied to the fill elements of the arguments. Regardless of definition, computing the fill element cannot cause side effects or an error.

Undo

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) ๐•จ.

Required functions

@@ -190,7 +191,7 @@ -

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.

@@ -410,8 +411,8 @@ - - + + @@ -421,7 +422,7 @@ - + -- cgit v1.2.3
โผ{rโ†๐”ฝ๐•ฉโ‹„!๐•ฉโ‰ก๐”ฝโผrโ‹„r}{๐”ฝ}Extended: no result check
โŒพ
โŸn โŸ(-n)Atomic number nAtomic number n; no check, like โผ
โŠ˜