@@ -5609,6 +5609,71 @@
56095609 ?. (width-in-order order.source.shape order.target.shape) ~
56105610 (width-fit-fields index.source.shape order.target.shape sub next)
56115611::
5612+:: Provisional, globally budgeted gate-free proof. %no includes a
5613+:: gate-bearing witness; an uninhabited sibling could invalidate it.
5614+:: Input types must be resolved and normalized under valid substitutions,
5615+:: from trusted source-backed interfaces and reader results. Collection
5616+:: list/unit names rely on their existing identity invariant; this arm
5617+:: does not validate fabricated internal types.
5618++$ igf-segment
5619+ $% [%field name=term]
5620+ [%head ~]
5621+ [%tail ~]
5622+ [%item ~]
5623+ [%case index=@ud]
5624+ ==
5625++$ igate-free [verdict=?(%yes %no %unknown) inhabited=? left=@ud path=(unit (list igf-segment))]
5626+++ gate-free-types
5627+ |= [types=(list itype) fuel=@ud path=(list igf-segment) index=@ud]
5628+ ^- igate-free
5629+ ?~ types [%yes | fuel ~]
5630+ ?: =(0 fuel) [%unknown | 0 ~]
5631+ =/ first=igate-free (gate-free-type i.types fuel [[%case index] path])
5632+ ?: =(%no verdict.first) first
5633+ =/ rest=igate-free $(types t.types, fuel left.first, index +(index))
5634+ ?: =(%no verdict.rest) rest
5635+ =/ inhabited=? |(inhabited.first inhabited.rest)
5636+ ?: |(=(%unknown verdict.first) =(%unknown verdict.rest)) [%unknown inhabited left.rest ~]
5637+ [%yes inhabited left.rest ~]
5638+++ gate-free-type
5639+ |= [typ=itype fuel=@ud path=(list igf-segment)]
5640+ ^- igate-free
5641+ ?: =(0 fuel) [%unknown | 0 ~]
5642+ =. fuel (dec fuel)
5643+ ?- -.typ
5644+ %fn [%no & fuel `(flop path)]
5645+ %atom [%yes & fuel ~]
5646+ %any-atom [%yes & fuel ~]
5647+ %flag [%yes & fuel ~]
5648+ %const [%yes & fuel ~]
5649+ %face $(typ body.typ, path [[%field name.typ] path])
5650+ %cell
5651+ =/ head=igate-free $(typ hed.typ, path [[%head ~] path])
5652+ =/ tail=igate-free $(typ tal.typ, fuel left.head, path [[%tail ~] path])
5653+ =/ inhabited=? &(inhabited.head inhabited.tail)
5654+ ?: &(=(%no verdict.head) inhabited.tail) head(left left.tail)
5655+ ?: &(=(%no verdict.tail) inhabited.head) tail
5656+ ?: |(!=(%yes verdict.head) !=(%yes verdict.tail)) [%unknown inhabited left.tail ~]
5657+ [%yes inhabited left.tail ~]
5658+ %collection
5659+ ?. |(=(%list name.typ) =(%unit name.typ)) [%unknown | fuel ~]
5660+ ?. ?=([* ~] args.typ) [%unknown | fuel ~]
5661+ =/ item=igate-free $(typ i.args.typ, path [[%item ~] path])
5662+ item(inhabited &)
5663+ %union
5664+ ?~ cases.typ [%unknown | fuel ~]
5665+ (gate-free-types cases.typ fuel path 0)
5666+ %noun [%unknown & fuel ~]
5667+ %var [%unknown | fuel ~]
5668+ %avar [%yes & fuel ~]
5669+ %rvar [%yes & fuel ~]
5670+ %nvar [%yes & fuel ~]
5671+ %rnvar [%yes & fuel ~]
5672+ %tag [%unknown | fuel ~]
5673+ %recursive [%unknown | fuel ~]
5674+ %jrec [%yes & fuel ~]
5675+ ==
5676+::
56125677+$ istate [next=@ud sub=isub caps=icaps binders=(list @ud) molds=imolds globals=(list term) externals=iexternals surs=(list term) mark-externals=imark-externals marks=(list term) jimports=ijimports reserved-molds=(list term) params=iparams active=(list term) tags=(list ipending) in-mold=? at=path top-molds=(list term) prelude=(unit ifile) holes=(list ihole) jrec-fuel=@ud projections=(list iwprojection)]
56135678+$ idiag [msg=tape sites=(list [at=span note=tape])]
56145679+$ iresult (each [typ=itype state=istate] idiag)
@@ -11382,6 +11447,60 @@
1138211447 =/ iface=ifile [env p.mts at ~ artifacts.resolution ~ `src graph]
1138311448 [%& [iface [[at iface] cache.p.js]]]
1138411449::
11450+:: A source-bound analysis of one named mold, not a module, island,
11451+:: request, watchability or runtime check. The host owns the trusted
11452+:: prepared prelude, canonical paths and reader/source version identities.
11453+:: The 256-node cap covers only classification, not source/graph work.
11454++$ igate-free-mold
11455+ [at=path source=@t name=term prepared=iprelude externals=iexternals marks=imark-externals modules=jbundle dependencies=jcache mold=ischeme requested=@ud budget=@ud result=igate-free]
11456+++ gate-free-mold-source
11457+ |= [file=path src=@t name=term externals=iexternals marks=imark-externals modules=jbundle prepared=(unit iprelude) fuel=@ud]
11458+ ^- (each igate-free-mold @t)
11459+ ?~ file [%| 'mold analysis needs a path ending in jibb']
11460+ ?. =(%jibb (rear file)) [%| 'mold analysis needs a path ending in jibb']
11461+ ?: |(=(file /lib/jibb/internal/jibb) =(file /lib/jibb/primitives/jibb))
11462+ [%| 'the prelude internal modules are private']
11463+ ?: ?=([%ui %api *] file) [%| 'API declarations need unsupported mold analysis']
11464+ ?: ?=([%ui %stores *] file) [%| 'store declarations need unsupported mold analysis']
11465+ =/ entries=jbundle (skim modules |=(m=jsource =(file at.m)))
11466+ ?: (gth (lent entries) 1) [%| 'duplicate root module sources']
11467+ =/ wrong-root=? ?~(entries | !=(source.i.entries src))
11468+ ?: wrong-root [%| 'root module source does not match bundle']
11469+ =/ parsed (parse file src)
11470+ ?: ?=(%| -.parsed) [%| 'mold source does not parse']
11471+ =/ mod=module p.parsed
11472+ =/ duplicate=(unit idiag) (duplicate-defs defs.mod)
11473+ ?^ duplicate [%| (show-duplicate-fields file src u.duplicate)]
11474+ ?~ prepared [%| 'mold analysis needs the prepared prelude']
11475+ ?. (module-scope-valid mod values.u.prepared molds.u.prepared)
11476+ [%| 'mold source has conflicting or unsupported scope']
11477+ =/ selected=(list def)
11478+ (skim defs.mod |=(d=def &(?=(%mold -.d) =(name.d name))))
11479+ ?~ selected [%| 'selected mold is not declared']
11480+ ?^ t.selected [%| 'selected mold is not unique']
11481+ ?> ?=(%mold -.i.selected)
11482+ =/ public=ifile iface.u.prepared
11483+ =/ js=jimports-result
11484+ (resolve-jibb-imports imports.mod externals marks modules ~[file] values.u.prepared molds.u.prepared ~ `public)
11485+ ?: ?=(%| -.js) [%| p.js]
11486+ =/ ms=imolds (collect-simple-molds defs.mod)
11487+ =/ vals=(list term) (global-value-names defs.mod)
11488+ =/ globals=(list term) (weld values.u.prepared (weld (import-binding-names imports.mod) vals))
11489+ =/ surs=(list term) (collect-sur-imports imports.mod)
11490+ =/ declared=(list term) (collect-mark-imports imports.mod)
11491+ =/ reserved=(list term) (weld molds.u.prepared (turn resolved.p.js |=(j=[face=term interface=ifile] face.j)))
11492+ =/ top=(list term) (turn ms |=(m=[name=term body=shape] name.m))
11493+ =/ state=istate [0 ~ ~ ~ ms globals externals surs marks declared resolved.p.js reserved ~ ~ ~ | file top `public ~ 256 ~]
11494+ =/ inferred=(unit [template=ischeme state=istate])
11495+ (infer-mold-template shape.i.selected state(active ~[name], in-mold &))
11496+ ?~ inferred [%| 'selected mold needs unsupported inference']
11497+ =/ template=ischeme template.u.inferred
11498+ =. typ.template (label-direct-union typ.template shape.i.selected name state)
11499+ =. typ.template (itype-normalize typ.template sub.state.u.inferred)
11500+ =/ cap=@ud (min fuel 256)
11501+ =/ analysis=igate-free (gate-free-type typ.template cap ~)
11502+ [%& [file src name u.prepared externals marks modules cache.p.js template fuel cap analysis]]
11503+::
1138511504:: +golden-types-with-modules fails closed for imports without prelude
1138611505:: scope. +golden-types-with-prelude resolves supported library graphs;
1138711506:: its report remains partial and unreachable sources are not examined.