| @@ -1040,6 +1040,44 @@ |
| 1040 | 1040 | opaque comparison-test value `(< 10)` in value position (needs a new `Value` variant with |
| 1041 | 1041 | reflexive, range-incompatible equality; ADR-28). `not(tests)` negation too. See ROADMAP.md. |
| 1042 | 1042 | |
| 1043 | +## ADR-30: `not(tests)` test negation on the RHS of `in` (DMN §10.3.2.6, rule 49) |
| 1044 | + |
| 1045 | +- **Context:** the last grammar-side `in`-RHS form deferred by ADR-27/ADR-28 — negating a |
| 1046 | + positive unary-test list, `x in not([1,2,3])` / `x in not(<5)` / `x in not([1..10])`. |
| 1047 | + ADR-28 flagged it as "LR(1)-solvable but the block is semantic." The block was a |
| 1048 | + *token-role collision*, not a real ambiguity: in the unary-test category `not(…)` is |
| 1049 | + **always** test negation (`x in not(t)` ≡ `not(x satisfies t)`, three-valued), NEVER the |
| 1050 | + boolean `not(…)` built-in — but the bare-endpoint branch `NbSum → … → NbPrimary` reached |
| 1051 | + the boolean `"not" "(" Expr ")"` production, so a `not` after `in` had two parses. |
| 1052 | +- **Decision:** ship it as a dedicated test-mode production, resolving the fork by *removing* |
| 1053 | + the rival from the bare branch. |
| 1054 | + - **`NbPrimary` drops the boolean `not`.** The `Nb*` chain exists only as `InRhs`'s |
| 1055 | + bare-endpoint branch; removing `"not" "(" Expr ")"` from `NbPrimary` means the bare |
| 1056 | + branch can never *start* with `not`. (A boolean `not(…)` is unaffected everywhere else — |
| 1057 | + it lives in the full `Primary`, reachable through `Sum`.) Semantically this is exactly |
| 1058 | + right: per spec a `not(…)` after `in` is test negation, not a boolean endpoint. |
| 1059 | + - **A dedicated `InRhs → "not" "(" Comma<UnaryTestElem> ")"` production.** With the bare |
| 1060 | + branch's `not` gone, this is the *only* production starting with `not` in the `in`-RHS |
| 1061 | + state — one shift target, LR(1)-clean (the `build.rs` no-conflict gate proves it). |
| 1062 | + Reusing `UnaryTestElem` means each inner element becomes a test via |
| 1063 | + `unary_test_from_expr` exactly like a bare list, so `not(5)` is the negated `= 5` test, |
| 1064 | + `not(<5)` a negated comparison, `not([1..10])` a negated interval — no special-casing. |
| 1065 | + - **AST: a new `UnaryTest::Not(Vec<UnaryTest>)`.** It carries the inner test list; no |
| 1066 | + `Expr` change. `eval_unary_test` OR-folds the inner tests (the same disjunction as a |
| 1067 | + bare list) and negates the result with a Kleene `not3`: `not(true)=false`, |
| 1068 | + `not(false)=true`, `not(null)=null`, and a *tainted* unknown (error-null / wrong-typed) |
| 1069 | + stays an error-null — mirroring `and3`/`or3` provenance, so negating an unknown never |
| 1070 | + manufactures a definite truth. (`x in not((null..10])` ⇒ null, not true.) |
| 1071 | +- **Tests:** unit test `membership_not_test_negation` covers list / bare / comparison / |
| 1072 | + interval / mixed inner tests and the Kleene-null case directly. The ingester's |
| 1073 | + `_in_rhs_supported` now admits `not(…)` after `in` (validated as a balanced paren group, |
| 1074 | + like a bare bracket list). The DMN-TCK has **no** `in not(…)` case in any suite, so no |
| 1075 | + fixture changed and no suite was re-ingested; the closed loop (`fixtures_test`) stays |
| 1076 | + green and the form is exercised by the unit test. |
| 1077 | +- **Consequence:** every `in`-RHS *grammar* form is now in. The two remaining deferrals are |
| 1078 | + purely semantic-value work, not grammar: unbounded omitted-endpoint ranges `[1..]` / |
| 1079 | + `[..10]` and the opaque comparison-test value `(< 10)` in value position (both ADR-29). |
| 1080 | + |
| 1043 | 1081 | ## Adding a wrapper — the host-binding contract |
| 1044 | 1082 | |
| 1045 | 1083 | The four wrappers (feel-pg, feel-wasm, feel-py, planned feel-lua) implement the same |