@@ -385,29 +385,35 @@
385 $(xs t.xs, ys t.ys)
385 $(xs t.xs, ys t.ys)
388−:: A finite, positive witness for two three-field tagged source cases.
388+:: Unlike the disjoint-reader fallback, source overlap may have repeated
389−:: The final @t fields admit noun zero. Each middle field is either an
389+:: tags. Bound both raw case traversal and the number of pair attempts.
390−:: explicit singleton or exactly two explicit singletons. Match noun
390+++ overlap-source-cases
391−:: values independently of their aura labels; other shapes are unknown.
391+ |= [cases=(list spec) fuel=@ud left=@ud]
392−++ witness-atom-values
394− ^- (unit (list @))
392+ ^- (unit (list tagged-case))
395− ?: ?=([%atom *] node)
393+ ?~ cases `~
396− ?~ value.node ~
394+ ?: =(left 0) ~
397− `~[u.value.node]
395+ =/ remaining=(unit @ud) (bounded-no-spec-unions i.cases fuel)
398− ?. ?=([%fork [* [* ~]]] node) ~
396+ ?~ remaining ~
399− ?. &(?=([%atom *] i.cases.node) ?=([%atom *] i.t.cases.node)) ~
397+ =/ tag=(unit @) (tagged-head i.cases)
400− ?~ value.i.cases.node ~
398+ ?~ tag ~
401− ?~ value.i.t.cases.node ~
399+ =/ rest $(cases t.cases, fuel u.remaining, left (dec left))
401+ `[[u.tag i.cases] u.rest]
402+++ overlap-repeated-tag
403+ |= cases=(list tagged-case)
406+ ?: (lien t.cases |=(c=tagged-case =(tag.c tag.i.cases))) &
402− `~[u.value.i.cases.node u.value.i.t.cases.node]
407+ $(cases t.cases)
403−++ witness-tagged-case
408+++ overlap-projections-match
404− |= node=imported
409+ |= [xs=(list tagged-case) ys=(list imported)]
405− ^- (unit [head=@ middle=(list @)])
410+ ^- ?
406− ?. ?=([%cell [%atom %tas [~ @]] [%cell * [%atom %t ~]]] node) ~
413+ ?. ?=([%cell [%atom %tas [~ @]] *] i.ys) |
407− =/ middle (witness-atom-values head.tail.node)
414+ ?. =(tag.i.xs u.value.head.i.ys) |
408− ?~ middle ~
415+ $(xs t.xs, ys t.ys)
409− `[u.value.head.node u.middle]
416+++ overlap-source-witness
410−++ overlap-zero-source
411 |= [module=term name=term cor=type]
417 |= [module=term name=term cor=type]
413 ?. ?=([%core *] cor) |
419 ?. ?=([%core *] cor) |
@@ -417,29 +423,100 @@
417 ?~ shape |
423 ?~ shape |
418 =/ body=(unit spec) (tagged-default-union u.shape 4)
424 =/ body=(unit spec) (tagged-default-union u.shape 4)
419 ?~ body |
425 ?~ body |
420− ?. ?=([%bcwt [* [* ~]]] u.body) |
426+ ?. ?=([%bcwt *] u.body) |
421− =/ one=spec i.p.u.body
427+ =/ cases=(unit (list tagged-case)) (overlap-source-cases p.u.body 4.096 128)
422− =/ two=spec i.t.p.u.body
428+ ?~ cases |
423− =/ first=(unit @) (tagged-head one)
429+ ?. (overlap-repeated-tag u.cases) |
424− =/ second=(unit @) (tagged-head two)
427− ?. =(u.first u.second) |
428− =/ cases=(list tagged-case) ~[[u.first one] [u.second two]]
429− ?. ?=(^ (safe-source-tagged-fuel-mode cases cor ~[name] 4.096 |)) |
430+ ?. ?=(^ (safe-source-tagged-fuel-mode u.cases cor ~[name] 4.096 |)) |
430 =/ tried=(each (list type) tang)
431 =/ tried=(each (list type) tang)
431− (mule |.((turn cases |=(c=tagged-case (~(play ut cor) [%kttr branch.c])))))
432+ (mule |.((turn u.cases |=(c=tagged-case (~(play ut cor) [%kttr branch.c])))))
432− ?. ?=([%& [* [* ~]]] tried) |
433+ ?. ?=([%& *] tried) |
433 =/ projected=(each (list imported) tang)
434 =/ projected=(each (list imported) tang)
434 (mule |.((turn p.tried |=(t=type (walk module t catalog ~ `cor)))))
435 (mule |.((turn p.tried |=(t=type (walk module t catalog ~ `cor)))))
435− ?. ?=([%& [* [* ~]]] projected) |
436+ ?. ?=([%& *] projected) |
436 ?^ (first-bads p.projected) |
437 ?^ (first-bads p.projected) |
437− =/ a (witness-tagged-case i.p.projected)
438+ ?. (overlap-projections-match u.cases p.projected) |
438− =/ b (witness-tagged-case i.t.p.projected)
439+ =/ witness=(unit overlap-proof-result) (overlap-case-pairs p.projected 4.096)
439− ?~ a |
440+ ?~ witness |
440− ?~ b |
441+ found.u.witness
441− ?. &(=(head.u.a u.first) =(head.u.b u.second) =(head.u.a head.u.b)) |
442+::
442− (lien middle.u.a |=(n=@ (lien middle.u.b |=(m=@ =(n m)))))
443+:: Positive overlap evidence only: false means no proof, not disjointness.
444+:: Fuel is shared across all examined nodes and sibling alternatives.
445++$ overlap-proof-result [found=? left=@ud]
446+++ overlap-known-atom
449+ (lien `(list term)`~[%t %tas %ud %f] |=(n=term =(n aura)))
450+++ overlap-inhabited-list
451+ |= [xs=(list imported) fuel=@ud]
452+ ^- (unit overlap-proof-result)
455+ =/ one=(unit overlap-proof-result) (overlap-inhabited i.xs (dec fuel))
458+ $(xs t.xs, fuel left.u.one)
460+ |= [x=imported fuel=@ud]
461+ ^- (unit overlap-proof-result)
467+ [%atom *] `[|(?=(^ value.x) (overlap-known-atom aura.x)) fuel]
468+ [%face *] $(x body.x)
469+ [%named *] $(x body.x)
470+ [%fork *] (overlap-inhabited-list cases.x fuel)
472+ =/ a=(unit overlap-proof-result) $(x head.x)
475+ $(x tail.x, fuel left.u.a)
479+ |= [xs=(list imported) y=imported fuel=@ud]
480+ ^- (unit overlap-proof-result)
483+ =/ p=(unit overlap-proof-result) (overlap-pair i.xs y (dec fuel))
486+ $(xs t.xs, fuel left.u.p)
488+ |= [a=imported b=imported fuel=@ud]
489+ ^- (unit overlap-proof-result)
492+ ?: ?=([%face *] a) $(a body.a)
493+ ?: ?=([%face *] b) $(b body.b)
494+ ?: ?=([%named *] a) $(a body.a)
495+ ?: ?=([%named *] b) $(b body.b)
496+ ?: ?=([%fork *] a) (overlap-pair-list cases.a b fuel)
497+ ?: ?=([%fork *] b) (overlap-pair-list cases.b a fuel)
498+ ?: ?=([%noun *] a) (overlap-inhabited b fuel)
499+ ?: ?=([%noun *] b) (overlap-inhabited a fuel)
500+ ?: &(?=([%cell *] a) ?=([%cell *] b))
501+ =/ p=(unit overlap-proof-result) $(a head.a, b head.b)
504+ $(a tail.a, b tail.b, fuel left.u.p)
505+ ?. &(?=([%atom *] a) ?=([%atom *] b)) `[| fuel]
507+ ?^ value.b `[=(u.value.a u.value.b) fuel]
508+ `[&(=(u.value.a 0) (overlap-known-atom aura.b)) fuel]
509+ ?^ value.b `[&(=(u.value.b 0) (overlap-known-atom aura.a)) fuel]
510+ `[&((overlap-known-atom aura.a) (overlap-known-atom aura.b)) fuel]
511+++ overlap-case-pairs
512+ |= [xs=(list imported) fuel=@ud]
513+ ^- (unit overlap-proof-result)
516+ =/ p=(unit overlap-proof-result) (overlap-pair-list t.xs i.xs (dec fuel))
519+ $(xs t.xs, fuel left.u.p)
444:: +read-mold-in: accept the /sur core as provenance. The core must be
521:: +read-mold-in: accept the /sur core as provenance. The core must be
445:: built against zuse or validated Ford imports, and its selected arm
522:: built against zuse or validated Ford imports, and its selected arm
@@ -455,7 +532,7 @@
455 [%| (crip "Hoon mold `{(trip name)}` is not declared")]
532 [%| (crip "Hoon mold `{(trip name)}` is not declared")]
456 ?. =(typ (~(play ut cor) (ream (cat 3 '*' name))))
533 ?. =(typ (~(play ut cor) (ream (cat 3 '*' name))))
457 [%| 'Hoon module provenance does not match the selected mold']
534 [%| 'Hoon module provenance does not match the selected mold']
458− =/ overlap=(each ? tang) (mule |.((overlap-zero-source module name cor)))
535+ =/ overlap=(each ? tang) (mule |.((overlap-source-witness module name cor)))
459 ?: &(?=(%& -.overlap) p.overlap) [%| 'Hoon union cases overlap']
536 ?: &(?=(%& -.overlap) p.overlap) [%| 'Hoon union cases overlap']
460 =/ result (read-with module name typ [~ cor])
537 =/ result (read-with module name typ [~ cor])
461 ?: ?=([%& *] result) result
538 ?: ?=([%& *] result) result
@@ -557,7 +634,7 @@
557 [%unsupported p.result]
634 [%unsupported p.result]
558 =/ selected=(each type tang) (mule |.((~(play ut cor) (ream (cat 3 '*' name)))))
635 =/ selected=(each type tang) (mule |.((~(play ut cor) (ream (cat 3 '*' name)))))
559 ?. ?=(%& -.selected) [%unsupported p.result]
636 ?. ?=(%& -.selected) [%unsupported p.result]
560− =/ overlap=(each ? tang) (mule |.((overlap-zero-source module name cor)))
637+ =/ overlap=(each ? tang) (mule |.((overlap-source-witness module name cor)))
561 ?: &(?=(%& -.overlap) p.overlap) [%invalid %overlap 'Hoon union cases overlap']
638 ?: &(?=(%& -.overlap) p.overlap) [%invalid %overlap 'Hoon union cases overlap']
562 =/ again=(each imported tang) (mule |.((walk module p.selected catalog ~ [~ cor])))
639 =/ again=(each imported tang) (mule |.((walk module p.selected catalog ~ [~ cor])))
563 ?. ?=(%& -.again) [%unsupported p.result]
640 ?. ?=(%& -.again) [%unsupported p.result]