eyereasoner/eyeprolog

EyeProlog turns portable ISO Prolog programs into answers and inspectable proofs.

19

stars

562

commits

Prolog

primary language

Sep 5, 2026

updated

eyereasoner.github.io/eyeprolog/

README

EyeProlog

npm version DOI

EyeProlog turns portable ISO Prolog programs into answers and inspectable proofs.

Read The Art of EyeProlog
Click the cover to read The Art of EyeProlog.

The single implementation reference is The Art of EyeProlog. It documents the language, built-ins, libraries, command line, JavaScript API, examples, proofs, conformance profile, and implementation.

Quick start

EyeProlog requires Node.js 18 or newer:

node --version

If necessary, upgrade through a Node version manager or the official Node.js download.

Run EyeProlog without installing it globally:

npx --yes eyeprolog
?- member(X, [prolog, logic]).
   X = prolog
;  X = logic.
?- halt.

For a persistent command, use a user-owned npm prefix:

npm install --global --prefix "$HOME/.local" eyeprolog
export PATH="$HOME/.local/bin:$PATH"
eyeprolog

Add the PATH export to your shell startup file. Do not use sudo npm install; npm's EACCES guidance also recommends a Node version manager or a user-owned prefix.

Run a program non-interactively:

printf 'human(socrates).\nmortal(X) :- human(X).\n' |
  npx --yes eyeprolog --proof --goal 'mortal(socrates)' -

Eyelet forward rules (:+)

Normal mode executes top-level Conclusion :+ Premise rules through the bundled Prolog library(eyelet) driver when no explicit -g/--goal is supplied. true :+ Goal prints answers and false :+ Goal emits a fuse/1; JavaScript run() follows the same rule. The module exports :+, stable/1, and becomes/2, and implements rule selection, fixed-point rounds, skolemization, state replacement, and duplicate suppression in Prolog. JavaScript retains only syntax recognition, static dependency/autoload planning, driver bootstrap, and private mutability/output adapters; it does not implement the fixed-point semantics. Strict ISO mode disables this extension.

Bundled src/lib/ predicates autoload in files, CLI/API goals, and the REPL; use --no-autoload to require explicit imports, and explicitly import libraries that introduce operators before using their syntax. See The Art of EyeProlog for the full semantics.

All 33 bundled modules that overlap Scryer's current src/lib/ surface cover Scryer's exported predicates, and all 26 bundled modules with public-module counterparts in Trealla's current library/ surface cover those Trealla exports as well. The stricter Trealla/Scryer intersection remains a separate portability profile. Runtime-dependent library primitives follow one ownership rule: src/lib/<module>.pl calls private adapters from src/<module>-host.js; pure Prolog libraries need no host file. This includes the full Scryer library(files) surface, Scryer character-list paths in library(pio) with atom-path compatibility, chars/UTF-8/term/Base64 helpers, the completed arithmetic/time/iso_ext surfaces, the full Scryer library(crypto), and Scryer-compatible TCP library(sockets). Filesystem, OS, and TCP socket side effects require Node; crypto uses Node's backend where needed, with Web Crypto also used for secure random bytes when available. Non-integral rational conversions remain structural rdiv(Numerator,Denominator) terms until rational numbers become processor numeric values.

RDF, Prolog, and symbiotic knowledge graphs

EyeProlog can sit behind an RDF knowledge graph without inventing a private graph representation. rdf-prolog-roundtrip converts RDF 1.2 datasets to ordinary rdf(Subject, Predicate, Object, Graph) facts, EyeProlog applies portable rules, and ground rdf/4 results can be converted back to RDF.

The checked Symbiotic Knowledge Graphs example uses named graphs and RDF 1.2 triple terms to distinguish trusted knowledge, AI-proposed statements, and human review. Its wide-audience companion explains why this is a useful present-day software model for human/AI/KG co-evolution: RDF supplies shared semantic memory, Prolog supplies explicit deliberation, AI supplies new hypotheses, and people remain participants in meaning and judgment.

The same RDF → Prolog → RDF boundary is exercised by five additional checked scenarios: cross-organization data sharing, explainable EV-depot configuration, operational incident response, software supply-chain vulnerability response, and a scientific evidence graph. Together they cover policy decisions, reversible configuration reasoning, dependency-graph diagnosis, transitive SBOM exposure, and evidence aggregation with explicit disagreement.

Benchmarks

EyeProlog has 20 checksum-protected wall-clock benchmarks spanning recursion/indexing, constraints, tabling/WFS, DCGs, Eyelet, search, term I/O, attributes, and rewriting. Short workloads are adaptively batched before timing so millisecond-scale noise is not mistaken for a regression. Run npm run benchmark; create a machine-local comparison point with npm run benchmark:baseline; use npm run test:benchmark for harness checks. Details are in The Art of EyeProlog.

Development

git clone https://github.com/eyereasoner/eyeprolog.git
cd eyeprolog
npm install
npm test

EyeProlog is released under the MIT License.

Contributors

josd

562 commits

eyereasoner/eyeprolog

EyeProlog turns portable ISO Prolog programs into answers and inspectable proofs.

19

stars

562

commits

Prolog

primary language

Sep 5, 2026

updated

eyereasoner.github.io/eyeprolog/

README

EyeProlog

npm version DOI

EyeProlog turns portable ISO Prolog programs into answers and inspectable proofs.

Read The Art of EyeProlog
Click the cover to read The Art of EyeProlog.

The single implementation reference is The Art of EyeProlog. It documents the language, built-ins, libraries, command line, JavaScript API, examples, proofs, conformance profile, and implementation.

Quick start

EyeProlog requires Node.js 18 or newer:

node --version

If necessary, upgrade through a Node version manager or the official Node.js download.

Run EyeProlog without installing it globally:

npx --yes eyeprolog
?- member(X, [prolog, logic]).
   X = prolog
;  X = logic.
?- halt.

For a persistent command, use a user-owned npm prefix:

npm install --global --prefix "$HOME/.local" eyeprolog
export PATH="$HOME/.local/bin:$PATH"
eyeprolog

Add the PATH export to your shell startup file. Do not use sudo npm install; npm's EACCES guidance also recommends a Node version manager or a user-owned prefix.

Run a program non-interactively:

printf 'human(socrates).\nmortal(X) :- human(X).\n' |
  npx --yes eyeprolog --proof --goal 'mortal(socrates)' -

Eyelet forward rules (:+)

Normal mode executes top-level Conclusion :+ Premise rules through the bundled Prolog library(eyelet) driver when no explicit -g/--goal is supplied. true :+ Goal prints answers and false :+ Goal emits a fuse/1; JavaScript run() follows the same rule. The module exports :+, stable/1, and becomes/2, and implements rule selection, fixed-point rounds, skolemization, state replacement, and duplicate suppression in Prolog. JavaScript retains only syntax recognition, static dependency/autoload planning, driver bootstrap, and private mutability/output adapters; it does not implement the fixed-point semantics. Strict ISO mode disables this extension.

Bundled src/lib/ predicates autoload in files, CLI/API goals, and the REPL; use --no-autoload to require explicit imports, and explicitly import libraries that introduce operators before using their syntax. See The Art of EyeProlog for the full semantics.

All 33 bundled modules that overlap Scryer's current src/lib/ surface cover Scryer's exported predicates, and all 26 bundled modules with public-module counterparts in Trealla's current library/ surface cover those Trealla exports as well. The stricter Trealla/Scryer intersection remains a separate portability profile. Runtime-dependent library primitives follow one ownership rule: src/lib/<module>.pl calls private adapters from src/<module>-host.js; pure Prolog libraries need no host file. This includes the full Scryer library(files) surface, Scryer character-list paths in library(pio) with atom-path compatibility, chars/UTF-8/term/Base64 helpers, the completed arithmetic/time/iso_ext surfaces, the full Scryer library(crypto), and Scryer-compatible TCP library(sockets). Filesystem, OS, and TCP socket side effects require Node; crypto uses Node's backend where needed, with Web Crypto also used for secure random bytes when available. Non-integral rational conversions remain structural rdiv(Numerator,Denominator) terms until rational numbers become processor numeric values.

RDF, Prolog, and symbiotic knowledge graphs

EyeProlog can sit behind an RDF knowledge graph without inventing a private graph representation. rdf-prolog-roundtrip converts RDF 1.2 datasets to ordinary rdf(Subject, Predicate, Object, Graph) facts, EyeProlog applies portable rules, and ground rdf/4 results can be converted back to RDF.

The checked Symbiotic Knowledge Graphs example uses named graphs and RDF 1.2 triple terms to distinguish trusted knowledge, AI-proposed statements, and human review. Its wide-audience companion explains why this is a useful present-day software model for human/AI/KG co-evolution: RDF supplies shared semantic memory, Prolog supplies explicit deliberation, AI supplies new hypotheses, and people remain participants in meaning and judgment.

The same RDF → Prolog → RDF boundary is exercised by five additional checked scenarios: cross-organization data sharing, explainable EV-depot configuration, operational incident response, software supply-chain vulnerability response, and a scientific evidence graph. Together they cover policy decisions, reversible configuration reasoning, dependency-graph diagnosis, transitive SBOM exposure, and evidence aggregation with explicit disagreement.

Benchmarks

EyeProlog has 20 checksum-protected wall-clock benchmarks spanning recursion/indexing, constraints, tabling/WFS, DCGs, Eyelet, search, term I/O, attributes, and rewriting. Short workloads are adaptively batched before timing so millisecond-scale noise is not mistaken for a regression. Run npm run benchmark; create a machine-local comparison point with npm run benchmark:baseline; use npm run test:benchmark for harness checks. Details are in The Art of EyeProlog.

Development

git clone https://github.com/eyereasoner/eyeprolog.git
cd eyeprolog
npm install
npm test

EyeProlog is released under the MIT License.

Contributors

josd

562 commits

Languages

Prolog

94.3%

JavaScript

5.6%