Commit f61de00
committed
refactor(engine): a fragment loses rows for two reasons; carry them apart
Prerequisite for adopting v1's absence semantics, and inert on its own — no
behaviour changes, 415 tests unmoved.
A term fragment can lose rows at a coordinate for two unrelated reasons, and a
constraint row has to react to exactly one of them. A **masked variable** is
genuinely absent there. A **sparse parameter** is a compressed dense array whose
missing rows mean a zero coefficient — SPEC §8's "sparse data gives sparse
variables", and what a generated binder emits by the tableful. Once the two are
multiplied into one frame the distinction is gone, which is why "drop the row
where a variable is absent" could not be written as an anti-join against the
term stream.
So the variable's own coordinates ride alongside as `TermFragment.presence`,
rewritten by the same shape operators that rewrite the term. The propagation
rule follows from the convention rather than from convenience:
variable leaf the variable's frame
parameter, constant none — sparsity is an encoding, not absence
a * b, a / b, -a the variable side's, unchanged: a sparse coefficient
zeroes a term, it does not unmake the variable under it
sum, group_sum cleared — §13 has reductions *skip* absent slots rather
than propagate them, which is what keeps a cross-module
accounting equation summing over a partly-masked dim
roll, shift still to do: the coordinate map has to be applied to
presence too, and shift's vacated edge unioned back in,
since SPEC §7 declares it contributes zero
Refs #81 parent 403fa33 commit f61de00
1 file changed
Lines changed: 25 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
65 | 79 | | |
66 | 80 | | |
67 | 81 | | |
| |||
299 | 313 | | |
300 | 314 | | |
301 | 315 | | |
302 | | - | |
| 316 | + | |
| 317 | + | |
303 | 318 | | |
304 | 319 | | |
305 | 320 | | |
| |||
348 | 363 | | |
349 | 364 | | |
350 | 365 | | |
| 366 | + | |
| 367 | + | |
351 | 368 | | |
352 | 369 | | |
353 | 370 | | |
| |||
372 | 389 | | |
373 | 390 | | |
374 | 391 | | |
| 392 | + | |
375 | 393 | | |
376 | 394 | | |
377 | 395 | | |
| |||
477 | 495 | | |
478 | 496 | | |
479 | 497 | | |
480 | | - | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
481 | 501 | | |
482 | 502 | | |
483 | 503 | | |
| |||
498 | 518 | | |
499 | 519 | | |
500 | 520 | | |
501 | | - | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
0 commit comments