| 1055 | // `Element(NaN, [1, NaN])` is `True` (user decision 2026-09-26, |
| 1056 | // `SEARCHED_VALUE_POLICY` in `library/collections.ts`). An absent |
| 1057 | // COLLECTION makes the answer absent through the missing gate. |
| 1058 | const result = membershipKleene(ce, value, collection); |
| 1059 | if (result === true) return ce.True; |
| 1060 | // An undecided membership stays undecided, unless a failed cell of an |
| 1061 | // invalid collection is what leaves it undecided. A valid lazy view |
| 1062 | // whose own `contains` handler declines stays undecided too, also |
| 1063 | // when the reason is an error: the `contains` handler of `Filter` |
| 1064 | // declines when its predicate gives an error for the searched value |
| 1065 | // (a predicate that fails, or a typed parameter that refuses the |
| 1066 | // value). The predicate did not judge that value, so the membership |
| 1067 | // is not known (`test/compute-engine/filter-predicate-errors.test.ts`). |
| 1068 | if (result === undefined && collection.isValid) return undefined; |
| 1069 | // A failed cell (an element that is, or holds, an `Error`) could be |
| 1070 | // the value: only a match among the valid cells decides, otherwise the |
| 1071 | // answer is the error of the cell (`Element(2, [1, <error>])`). |
| 1072 | // A walk that stopped before the end leaves the answer undecided. |
| 1073 | const failed = firstFailedElementError(collection); |
| 1074 | if (failed === 'incomplete') return undefined; |
| 1075 | if (failed !== undefined) return failed; |
| 1076 | return result === undefined ? undefined : ce.False; |
| 1077 | }, |
| 1078 | }, |
| 1079 | |
| 1080 | NotElement: { |
| 1081 | examples: ['4 !in Set(1, 2, 3)'], |
| 1082 | // A restricted collection, `[1]{c}`, is threaded whole, as `Contains` |
| 1083 | // threads its collection: the answer is computed on the present |
| 1084 | // collection and is absent once `c` fails. The value (position 0) is not |
| 1085 | // threaded: an absent value is not a member (user decision 2026-09-26). |
| 1086 | threadsConditionals: [1], |
| 1087 | // An absent collection makes the answer absent (`Missing`, the marker of |
| 1088 | // a boolean codomain), as for `Contains`. Only the collection strips |
| 1089 | // `missing`: an absent value is simply not a member. |
| 1090 | missingBehavior: 'propagate', |
| 1091 | missingStrip: [1], |
| 1092 | complexity: 11200, |
| 1093 | signature: '(any, any) -> boolean', |
| 1094 | description: 'Test whether a value is not an element of a collection.', |
| 1095 | canonical: (args, { engine: ce }) => { |