zelph 0.9.7
🧠 Neural Networks in the Graph
zelph can now embed neural networks directly inside its semantic network — neurons are ordinary graph nodes, synapses are weighted edges (invisible to the reasoning engine), and layers are ordinary sets. Sub-graphs compile into feed-forward networks on demand, are trained via SGD, and write their weights back into the graph.
- New
≈rule condition operator: rules can consult a trained network — guard mode verifies existing facts against the model, generator mode proposes new bindings above a confidence threshold. The network's confidence becomes the deduced fact's probability, stored in the same weight store as ordinary fact probabilities. - 12 new Janet functions (
zelph/nn-connect,zelph/nn-compile,zelph/nn-train-nodes,zelph/nn-eval-nodes,zelph/approx, …). - New standard library script
nn.zphwith high-level helpers (nn/link-predictorgoes from graph facts to a rule-usable network in one call). - Proof of concept on real Wikidata data:
examples/neural/nn-wikidata-demo.zphlearns country→continent (P30) links, verifies existing facts, and proposes candidates — with confidences flowing back into the graph. - New documentation page: Neural Networks in the Graph.
📚 Standard Library and .import Resolution
- zelph now ships a standard library (
arithmetic,binary-arithmetic,nn,sparql, plus anexamples/tree), installed system-wide by all packages (e.g./usr/share/zelphon Linux) and included asstdlib/in the release archives. .importresolves scripts against the working directory first, then the standard library; the.zphextension is optional:.import sparql,.import examples/english. Search paths can be overridden via$ZELPH_STDLIB.- Scripts passed on the command line resolve the same way (
zelph examples/english), and the packaged test suites are now hermetic (Chocolatey and Homebrew run them again at install/test time).
🔢 Number Literals (&)
- New
&prefix for number literals:&42is always decimal input, regardless of the internal representation. It delegates to the redefinable Janet functionzelph/number— the numeric representation lives entirely in scripts, not in the engine. - New
binary-arithmetic.zph: multi-digit addition in base 2 from the 16 hand-written full-adder facts — no generated lookup table, pure native zelph syntax.
🗂 Node Clusters (Transactional Workspaces)
- New commands
.cluster,.cluster-drop,.cluster-merge: record every node created during an experiment and roll it back (or commit it) with a single command. Pre-existing knowledge is never touched.
⚡ Reasoning Performance
- Subject/object-anchored candidate snapshots now also apply to conditions with concrete constants. Previously such conditions scanned the entire relation extent — e.g. all ~15 million P31 facts of a Wikidata dump per rule application. A representative Wikidata rule dropped from 29 s to 1.5 s.
- The template-node detection that protects this fast path is now structurally precise (deep variable check), keeping cons-list/arithmetic rules correct.
🐛 Fixes
- Variable display names are no longer "stolen" when a later rule reuses the same variable names;
.list-rulesno longer degrades earlier rules to«??»monstrosities. - Unnamed variable nodes are never expanded structurally in output anymore.
- REPL no longer gets stuck after a Janet error inside a
%block.
All 108 test cases pass on Linux, macOS, and Windows. Debian packages now additionally install the standard library to /usr/share/zelph.