Commit 4faa7e4
committed
feat(hhtl + pearl_junction): NiblePath utility methods + Pearl-junction figure classifier
Adds the small surface that retires the "thinking = addressing" conjecture
(E-4 in bardioc's EPIPHANIES.md) into committed code, plus three utility
methods on NiblePath that the classifier and other downstream consumers
need.
NiblePath additions (crates/lance-graph-contract/src/hhtl.rs):
- is_descendant_of(other) - symmetric companion to existing
is_ancestor_of; equivalent to other.is_ancestor_of(self) but reads more
naturally at some call sites.
- is_sibling_of(other) - distinct paths sharing the same parent (and
thus the same depth). False for basins (no parent), differing depths,
or equal paths.
- common_ancestor(other) - longest common prefix; None if the paths
share no basin or either is empty. Symmetric.
All three are const fn + #[must_use], matching the existing NiblePath
surface conventions. Pure bit-shift arithmetic; O(depth) in the worst
case for common_ancestor; tests cover roundtrip + symmetry + the
empty-path / basin-mismatch edges.
NEW module: crates/lance-graph-contract/src/pearl_junction.rs
Classifies a pair of SPO edges (s1->o1, s2->o2) into Pearl's three
causal junctions plus the reverse chain:
Chain (o1 == s2) - head-to-tail; Deduction
ChainRev (s1 == o2) - reverse chain; Deduction
Fork (s1 == s2) - common cause (shared subject is the child);
Induction
Collider (o1 == o2) - explaining-away (shared object is the parent);
Abduction
Unrelated - no shared term
Pure-function classifier; no graph walk; const fn end-to-end (uses a
const-context NiblePath equality helper because PartialEq is not const
in stable Rust 1.95).
Anti-swap guard: the canonical dog/cat/mammal example is the first test
and is enumerated in the module docstring. The earlier framing in the
peer-session reviews had SharedSubject / SharedObject inverted relative
to the induction/abduction chirality; the corrected mapping ships here
with the dog/cat example so the inversion cannot recur silently.
Tests cover: collider (dog/cat/mammal), fork (dog->mammal,
dog->pet), chain (dog->mammal->animal), ChainRev, Unrelated, the
deterministic order-of-checks (Chain fires before ChainRev when both
would match), and a const-context invocation proving the classifier
works at compile time.
Sister module to nars (which owns the full InferenceType taxonomy);
PearlJunction::nars_rule() returns the subset (Deduction/Induction/
Abduction) that arises from the three-junction classification.
Provenance: bardioc EPIPHANIES.md entry E-4 (corrected), peer-session
review rounds 1+2 on bardioc PR #15, and the
lance-graph/.claude/plans/* references to FIGURE_RULES that name the
same classification structurally.1 parent 2d78b85 commit 4faa7e4
3 files changed
Lines changed: 413 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
187 | 187 | | |
188 | 188 | | |
189 | 189 | | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
190 | 277 | | |
191 | 278 | | |
192 | 279 | | |
| |||
323 | 410 | | |
324 | 411 | | |
325 | 412 | | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
326 | 485 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| 76 | + | |
76 | 77 | | |
77 | 78 | | |
78 | 79 | | |
| |||
0 commit comments