r/prolog • u/Neurosymbolic • 2h ago
Alternative Approaches to Symbolic Regularization of Neural Training
r/prolog • u/Neurosymbolic • 2h ago
I am not the author. This is not my project.
However I do wonder, if there was a fairly mature prolog implementation built on top of the JVM with seamless Java interop, would it be more mainstream than it is for the same reason Clojure became relatively popular?
Why walk all the way back down a mountain when you can call a helicopter?
Traditional programming languages love CALL and RETURN. SCBM-Prolog takes a different approach:
Once you reach the summit, the computation is complete. There is no need to retrace your steps. You can simply call a helicopter and fly back down.
And if you encounter a dead end? Just backtrack and try another trail. That's Prolog!
Perhaps we have been making Prolog compilers more complicated than they need to be.
Forget the return journey. Enjoy the climb! 🚁
I've written a short article on Medium explaining this idea.
I've just released SCBM-Prolog v1.60, which introduces garbage collection for proof sequences.
SCBM (Sasagawa Continuation Backtracking Model) is an alternative Prolog execution model I've been developing, based on doubly linked proof sequences rather than the traditional WAM architecture.
Until now, SCBM-Prolog had garbage collection for working memory, but not for the proof sequences themselves.
The new mechanism takes advantage of Prolog's backtracking semantics. When execution returns to a FIRST node and the corresponding proof sequence is restored, the proof objects created after that point can be reclaimed by restoring the saved allocation pointers.
Interestingly, adding this garbage collection mechanism actually improved execution speed!
On my 9-Queens benchmark, repeated 16 times, SCBM-Prolog achieved approximately 14.36 MLIPS.
My hypothesis is that reusing the proof-sequence memory improves CPU cache locality, possibly reducing L3 cache misses. This has not yet been confirmed through hardware performance counters.
I find this particularly interesting because garbage collection is usually associated with additional overhead, rather than improved performance.
SCBM-Prolog is still an experimental implementation, but the results suggest that this alternative execution model has considerable potential.
I've written a more detailed explanation, including the benchmark and implementation, on Medium:
Medium article: SCBM-Prolog Now Has Garbage Collection — Achieving 14 MLIPS on 9 Queens | by Kenichi Sasagawa | Nov, 2026 | Medium
Feedback, criticism, and technical discussion are very welcome!
r/prolog • u/Logtalking • 5d ago
Hi,
Hercutalk 0.47.1, a Jupyter Kernel for Logtalk, is now available, providing support for Shumway Prolog and noteworthy fixes and improvements:
Fixed rendering of aliased unbound variables
Fixed encoding of binding values as JSON strings to prevent to avoid backend-dependent interpretation of the empty-list atom as a JSON array
Fixed DCG handling graphs to not depend on the Prolog double_quotes flag
Implemented recovering from malformed JSON requests
Write a log file for debugging kernel errors that require restarting the server
You can browse a rendered version kernel overview notebook at:
The kernel is available from both PyPI and Conda:
https://pypi.org/project/logtalk-jupyter-kernel/
https://anaconda.org/conda-forge/logtalk-jupyter-kernel
Happy logtalking!
Paulo
r/prolog • u/Logtalking • 4d ago
Hi,
Logtalk for VSCode 0.93.1 released with support for Shumway Prolog and improvements to code formatting. List of recent changes:
Fix document formatting to ensure a single empty line after object, category, and protocol opening directives
Fix document formatting to ensure a single empty line after uses/1-2, use_module/1-2, and alias/2 directives
Fix document formatting to convert space and mixed indentation to tabs using the editor tab size
Fix document formatting of conditional compilation blocks to avoid adding tabs to existing indentation on repeated formatting
Fix document formatting to preserve multi-line conditional directive layout, keeping closing delimiters aligned with the directive opening
Fix document formatting of conditional compilation branches to shift complete clauses while preserving their body indentation
Update the "logtalk.diagrams.format" setting to also allow selecting Cytoscape (cx2) and PlantUML (puml) formats
Update the readme file with advice on how to turn off annoying, disruptive, and useless completions generated by VSCode itself
Fix keyword completions being offered while typing the lowercase tail of a variable (e.g., _Var)
Fix completions for libraries, flags, make targets, message kinds, and throw terms to be case sensitive
Add support for Shumway Prolog
Add quick fix for the linter warning on cuts before error throwing goals
Compile the $LOGTALKHOME/coding/vscode.lgt support file in optimal mode
Add code completions for developer tool, port, and contribution names
Update code completions for library names for recently added libraries
Update code completions for logtalk_make/1 targets
The extension is available from both VSCode and VSCodium marketplaces:
https://marketplace.visualstudio.com/items?itemName=LogtalkDotOrg.logtalk-for-vscode
https://open-vsx.org/extension/LogtalkDotOrg/logtalk-for-vscode
Happy logtalking!
Paulo
r/prolog • u/Logtalking • 5d ago
Hi,
Logtalk 3.103.0 is now available for downloading at:
This is a major library-focused release, adding libraries for constraint solving, time-series forecasting, recommendation, and feature selection. It also brings substantial improvements to machine-learning libraries, expands testing and coverage tools, adds Shumway Prolog support, and includes compiler, runtime, and portability fixes.
Added support for Shumway Prolog 0.9.3 and later (use latest git version)
asp for representing Answer Set Programming problems and invoking Clingo or zetesis
atms implementing the Horn fragment of an Assumption-based Truth Maintenance System
flow_networks for maximum flow, minimum cut, minimum cost flow, Gomory-Hu cut trees, and other network-flow tools
minizinc for representing constraint satisfaction and optimization problems and invoking MiniZinc solvers
omt for representing OMT problems and invoking supported solvers
problog for representing ProbLog problems and invoking the ProbLog command-line tool
sat for representing SAT problems and invoking Kissat, CaDiCaL, Glucose, or Z3 solvers
simple_temporal_networks for Simple Temporal Networks
smt for representing SMT problems and invoking Bitwuzla, cvc5, Yices 2, or Z3 solvers
souffle for representing Datalog problems and inspecting Souffle relations
time_series_protocols defining common protocols and test datasets
baseline_forecasting for naive, seasonal naive, mean, and drift forecasts
intermittent_demand_forecasting for Croston, SBA, and TSB forecasting
exponential_smoothing for simple, Holt, and Holt-Winters forecasting
theta_forecasting for automatic seasonality detection and seasonal adjustment
knn_forecasting for k-nearest-neighbor forecasting
time_series_regression for autoregressive models fitted by least squares
recommender_protocols defining dataset and scoring protocols, shared utilities, and similarity strategies
knn_item_recommender for item-based recommendations
knn_user_recommender for user-based recommendations
slope_one_recommender implementing weighted Slope One
tfidf_recommender for weighted TF-IDF content-based recommendations
jaccard_recommender for content-based recommendations using Jaccard similarity
bm25_recommender for content-based recommendations using asymmetric Okapi BM25 relevance
feature_selection_protocols for common protocols and predicates used by feature-selection algorithms
fisher_score_feature_selector for Fisher-score feature selection
mutual_information_feature_selector for mutual-information feature selection
chi_square_feature_selector for chi-square feature selection
relief_feature_selector for binary classification
relieff_feature_selector for multiclass classification
`rrelieff_feature_selector for selecting features for numeric regression
mrmr_feature_selector for minimum-redundancy maximum-relevance selection
lasso_feature_selector for selection using Lasso regression coefficients
emeans_clusterer implementing the Meta FAIR e-means algorithm
The ant_colony, differential_evolution, genetic_algorithm, particle_swarm_optimization, simulated_annealing, and tabu_search libraries now accept a random generator object, providing additional flexibility
Improved the mlp_classifier, one_class_svm_anomaly_detector, lof_anomaly_detector, spectral_clusterer, tsne_projection, and umap_projection libraries with performance improvements, stronger validation, expanded diagnostics, and fixes for numerical and edge cases
Updated learned model representations and behavior in several libraries; see the release notes for compatibility details
Improved shared training-data preprocessing across clustering libraries, preserving numerical results and exported model formats
Fixed classifier and regression libraries handling of custom functors
Added symmetric_eigen_partial/7 to linear_algebra and sample/3-4 to random
Added Git working-tree and repository predicates, and a process predicate for accessing raw and normalized exit status
Improved performance across numerous cryptography, optimization, machine-learning, and utility libraries
Fixed issues in HTTP body validation, sockets, geospatial calculations, text processing, and other libraries
Added Azure DevOps, Gitea, and Jira bug-report support to issue_creator and the testing scripts
Added Sonar Generic Coverage XML export support to lgtunit
Added a -k option to the testing scripts for listing expected failed tests and test sets
Improved test-run summaries with fastest and slowest tests and test sets, plus mean and median runtimes
Improved the performance and portability of the testing scripts
Fixed code coverage source locations for predicates defined in included files
Improved packs lock-file validation and locked restores
*Improved the performance of the code_metrics, dead_code_scanner, diagrams, and lgtdoc tool tests.
Updated the CycloneDX SBOM exporter to version 1.7
Improved Mermaid support in diagrams; Mermaid version 12 or later is now required
Extended logtalk_load_context/2 so the singletons/1 and variable_names/1 keys can refer to either the term being term-expanded or the goal being goal-expanded
Improved compiler performance
Fixed a multi-threaded runtime race condition and a threaded-engine deadlock
Fixed linter checks for duplicated clauses and float comparisons
Updated the Trealla Prolog adapter for newer versions
Improved the PDF API documentation with more compact styling and internal links
Added AI coding assistant support files under coding/ai
Updated the portable Docker image to support Shumway Prolog and additional services
Update Prolog conformance tests for the (>>)/2 evaluable and the functor/3 and arg/3 predicates
Added example of network-flow modeling
Added ATMS-based diagnosis example
Thanks to Andrew Davison, Arun Majumdar, Gustavo Brown, and Lindsey Spratt for bug reports, patches, and analysis.
For details and a complete list of changes, please consult the release notes at:
https://github.com/LogtalkDotOrg/logtalk3/blob/master/RELEASE_NOTES.md
Happy logtalking!
Paulo
r/prolog • u/sym_num • 10d ago
I'm pleased to announce the release of SCBM-Prolog version 1.50.
Since my previous report, I have completed the implementation of several important language features, including cut (!), call/1, negation as failure (not/1), and disjunction (;).
The compiler can also handle Japanese predicate names, and various tests involving recursion, unification, and backtracking have been successful.
SCBM (Sasagawa Continuation Backtracking Model) is an alternative Prolog execution model that does not use the conventional WAM architecture.
Its central idea is to represent a proof tree as a linear, doubly linked proof sequence, integrating success and failure continuations into a unified execution mechanism.
With version 1.50, I believe I have demonstrated that this approach is not merely a theoretical idea, but has the potential to serve as the foundation of a practical Prolog implementation.
Of course, further testing, refinement, and performance evaluation are still necessary. However, the major technical challenges have now been addressed, and development has progressed considerably faster than I originally expected.
My next step is to focus on documentation and a technical paper explaining the SCBM model, its underlying principles, implementation techniques, and experimental results.
I hope this work will offer another perspective on Prolog implementation and perhaps encourage students and independent developers to explore alternative execution models.
The project is available on GitHub:
https://github.com/sasagawa888/scbm
Comments, questions, and technical feedback are always welcome.
r/prolog • u/sym_num • 13d ago
I've just released SCBM-Prolog Ver 1.29.
Development has been progressing much more smoothly than I originally expected. There were many difficult challenges along the way, especially in implementing backtracking, restoring proof sequences, and handling recursive predicates.
However, the core execution mechanism is now working reliably, and the remaining tasks are becoming much clearer.
As I mentioned in the release notes:
SCBM-Prolog started with a simple question:
"Why does Prolog work?"
I wanted to express Prolog's execution mechanism using the simplest possible data structures and algorithms.
By representing proof trees as linear proof sequences using doubly linked lists, SCBM provides a unified way to handle execution, success, failure, and backtracking.
The current implementation successfully handles recursive predicates, permutation generation, prime number enumeration, and the 9 Queens problem, including all 352 solutions.
Performance has also reached approximately 10 MLIPS on my Ryzen/Linux system.
The remaining tasks include refining the cut implementation, implementing call/1, not/1, and disjunction, adding Unicode support, and completing the documentation.
There is still work to do, but the most difficult part—the fundamental execution mechanism—appears to be behind me.
At this pace, I believe SCBM-Prolog will reach its first complete version in the near future.
It has been an exciting journey, and I'm looking forward to seeing how far this simple approach can go.
r/prolog • u/sym_num • 17d ago
I've been developing SCBM-Prolog, an experimental Prolog compiler based on my own execution architecture.
Recently, SCBM reached an important milestone: it can now handle recursive predicates, complex backtracking, permutations, and the 9-queens problem.
My original goal was to develop an alternative to the Warren Abstract Machine (WAM), hopefully achieving comparable performance someday.
But I've recently discovered another goal.
I want to make it possible for amateur programmers to build their own Prolog compiler.
I first encountered Prolog around 1980. At that time, running Prolog generally required access to a minicomputer.
I remember disassembling a Prolog interpreter written for the 6502 processor, trying desperately to understand how it worked. Unfortunately, I couldn't figure it out.
Nearly half a century later, I'm finally building my own Prolog system.
Recently, I watched a documentary about Tamiya, the famous Japanese plastic model manufacturer.
As a child, I loved building Tamiya models. Their parts fitted together beautifully, and their instruction manuals made even complicated machines accessible to children.
That gave me an idea:
Why not make SCBM-Prolog something like a Tamiya plastic model kit?
Instead of simply publishing source code, I could provide architectural diagrams, explanations, and step-by-step instructions so that programming enthusiasts could understand the system and build their own compiler.
One advantage of SCBM is that its execution model is based on a linear proof sequence represented by a doubly linked list. The generated C code corresponds relatively directly to this model.
I believe this could make the implementation easier to understand than a highly optimized WAM-based system.
Of course, SCBM is still experimental. There is much work ahead, including optimization, implementing cut, and expanding language support.
But I now have two goals:
Develop an original Prolog execution architecture with competitive performance.
Make Prolog compiler construction accessible and enjoyable for hobby programmers.
I've written a longer article about this idea on Medium:
SCBM-Prolog: Build Your Own Prolog System
SCBM-Prolog: Build Your Own Prolog System | by Kenichi Sasagawa | Nov, 2026 | Medium
I'm curious what other Prolog enthusiasts think.
Would a well-documented, build-your-own Prolog compiler be interesting to you?
After all, using a programming language is fun, but building one yourself can be even more rewarding.
r/prolog • u/sym_num • 19d ago
I'd like to share some recent progress on my experimental Prolog compiler, SCBM-Prolog.
SCBM (Sasagawa Continuation Backtracking Model) is an alternative execution architecture to the traditional WAM. It represents Prolog execution as a linear proof sequence using a bidirectional list, rather than following the conventional WAM approach.
After nearly three months of struggling with the perm1 permutation problem, I finally solved the remaining backtracking issues.
The key was reconsidering how the system handles complete failure and restores the original predicate within the proof sequence.
With perm1 fully working, I moved on to the 9 Queens problem.
And it worked! All valid solutions were generated successfully.
The current benchmark for 9 Queens is:
Execution time: 0.047630 seconds
Performance: approximately 7.23 MLIPS
Compiler: GCC with -O0 (no optimization)
There is still considerable room for improvement. My next target is 20 MLIPS.
These results suggest that the SCBM architecture can handle complex recursive backtracking and may provide a relatively simple and lightweight foundation for implementing a Prolog compiler.
Of course, this is still an experimental implementation. More testing, optimization, and language features are needed. In particular, the cut operator (!) has not yet been implemented.
I have written a more detailed development report on Medium:
SCBM-Prolog: Operation Orion and the Decisive Battle at Gamilas
The somewhat unusual title comes from Space Battleship Yamato, a classic Japanese science-fiction series. I've been treating the development process as a voyage through space, with each difficult bug representing another major battle. :)
The project is open source, and I welcome technical feedback, suggestions, and criticism.
The decisive battle is over. Now begins the journey home!
r/prolog • u/sym_num • 22d ago
I've released SCBM-Prolog ver1.11, an experimental Prolog implementation based on a new execution model using a linear proof sequence represented by a doubly linked list.
I've been debugging the system using the likes/2 example from Peter Norvig's Paradigms of Artificial Intelligence Programming (PAIP).
The main challenge was handling backtracking after complete failure. When a predicate is replaced by its recursively expanded body, the original predicate must eventually be restored so that the remaining alternatives can be explored.
After fixing this restoration mechanism, SCBM-Prolog now produces all six expected solutions.
This is a small but important milestone. It suggests that the basic idea of executing compiled Prolog code through a dynamically reconstructed proof sequence may be viable.
I've written a short article explaining the problem and the solution:
SCBM-Prolog: Cat Successfully Captured — Heading Out of the Solar System
The implementation is still experimental, and many issues remain. My next target is fact/2, which is not yet working correctly.
I'd be happy to hear any thoughts or suggestions from fellow Prolog enthusiasts, particularly about alternative approaches to backtracking and execution-state restoration.
r/prolog • u/alexcommacommacomma • Oct 19 '26
This has been sitting in my head for over 6 months since the second lecture I had on Logic Programming where I was introduced to SWI-Prolog's `trace` predicate (I'm not sure if it exists in other implementations).
This is what the output of `?- sibling(sally, erica).` looks like with tracing on:
5 ?- trace.
true.
[trace] 5 ?- sibling(sally, erica).
Call: (12) sibling(sally, erica) ? creep
Call: (13) parent_child(_23350, sally) ? creep
Call: (14) father_child(_23350, sally) ? creep
Exit: (14) father_child(tom, sally) ? creep
Exit: (13) parent_child(tom, sally) ? creep
Call: (13) parent_child(tom, erica) ? creep
Call: (14) father_child(tom, erica) ? creep
Exit: (14) father_child(tom, erica) ? creep
Exit: (13) parent_child(tom, erica) ? creep
^ Call: (13) not(sally=erica) ? creep
^ Exit: (13) not(user:(sally=erica)) ? creep
Exit: (12) sibling(sally, erica) ? creep
My question: Can there be a program that, given *nothing more* than this trace, can figure out (synthesize, I suppose) a set of rules and facts which would yield this trace for the same query?
Further question: Since the first program would accept a single trace and output a single set of facts and rules, can there be a program which takes several of these outputs and generalizes them? So if we fed to this pipeline a representative enough sample of queries and traces of our program, we would be able to synthesize the program exactly?
Is this possible? Does it exist? Is this something that has been done before? Is there any research on it? (I'm sure someone much smarter than me has thought about it before, I'm surely not the only one who's thought of this)
r/prolog • u/sym_num • Oct 17 '26
After about six months of experimenting with SCBM-Prolog, I have decided to fundamentally redesign its execution model.
I am calling this new effort Project YAMATO.
In SCBM3, I used stacks to manage success and failure continuations. This worked reasonably well for ordinary execution, but repeated backtracking in recursive predicates caused serious problems. In particular, necessary success continuations could be lost.
I tried many approaches to solve this problem, but none was completely satisfactory.
So I decided to return to the original idea behind Prolog: SLD resolution itself.
Instead of managing continuations primarily through stacks, Project YAMATO will represent the proof process using a doubly linked list of predicate objects.
Each object will contain its execution state, including variable pointers, local stack information, argument counters, and a pointer to the corresponding C code label.
The execution model will be straightforward:
Success: Follow the list forward and execute the next predicate object.
Failure: Traverse backward to find an available choice point and perform backtracking.
Recursion: Expand and replace recursive goals with new predicate objects, just as in SLD resolution.
Execution: Use C's computed goto mechanism to avoid the overhead of repeated C function calls.
The main goal is to make the runtime structure correspond directly to the SLD proof process.
The Warren Abstract Machine is an excellent execution model, but its internal architecture is considerably more complex than the original SLD resolution concept.
I want to explore a different approach.
If you understand SLD resolution, you should be able to understand the execution mechanism of Project YAMATO.
At the same time, I hope to achieve good performance by using direct jumps in C.
Of course, I do not yet know whether this approach will be competitive in speed. Linked-list operations and object creation have their own costs.
That is something I intend to investigate experimentally.
My first goal is to correctly execute recursive and nondeterministic programs such as perm1/2, including repeated and deeply nested backtracking.
The target completion date is October 2027.
Since my professional work will keep me busy, I intend to develop this gradually as a personal research project.
The name YAMATO comes from the Japanese science-fiction anime Space Battleship Yamato. In the story, the spaceship has one year to complete its mission and return to Earth with the Cosmo Cleaner.
I have given myself the same one-year deadline.
I have written a more detailed explanation of the design on Medium:
I would be interested in hearing your thoughts, particularly about representing SLD proof states using a doubly linked list and the trade-offs involved in this approach.
Hopefully, I will return to Earth with the Cosmo Cleaner in October 2027!
r/prolog • u/sym_num • Oct 18 '26
I have released N-Prolog Ver 5.20.
During the development of SCBM-Prolog, I discovered some bugs related to unification in N-Prolog.
These bugs have been fixed in this release.
If you encounter any bugs or unexpected behavior, please let me know. Bug reports are always welcome.
Thank you for your continued interest in N-Prolog!
r/prolog • u/schmuhblaster_x45 • Oct 15 '26
r/prolog • u/sym_num • Oct 12 '26
I've been struggling with my experimental SCBM-Prolog implementation for several months now.
SCBM stands for Sasagawa Continuation Backtracking Model. It's my attempt to implement Prolog using explicit success and failure continuations, with goto-based control flow in C.
To be frank, there were times when I thought the whole approach was simply too complicated and that I should abandon it.
But after months of debugging, failed experiments, and redesigns, I feel I'm finally reaching a deeper understanding of the problem.
The key insight is surprisingly simple:
Backtracking control is dynamic. It must return to the appropriate choice point according to the execution history.
Variable identities must remain consistent. Within each clause invocation, the original variable pointers must be preserved.
Recursion requires environment restoration. When execution returns from a recursive call through a success continuation, the caller's original variable pointers must be restored.
The third point was particularly important.
When backtracking occurs deep inside a recursive predicate, execution may eventually succeed and return through multiple success continuations. At each level, the corresponding variable environment must be restored.
I had overlooked this requirement and also introduced a bug in the propagation of variable pointers.
Looking back, these requirements seem quite natural. But it took me months of trial and error to understand their implications for my implementation.
I'm not claiming that I've solved everything yet. And I'm certainly not claiming that SCBM is superior to WAM or conventional Prolog implementations.
This is an experiment in exploring a different approach to Prolog execution, and also a personal intellectual challenge.
I originally set October 20 as my target date. There are only eight days left.
I was seriously considering abandoning SCBM and returning to a more conventional SLD-based implementation. But now that the underlying issues are becoming clearer, I've decided to keep pursuing the original idea a little longer.
Perhaps it will work. Perhaps I'll discover another fundamental problem.
Either way, these months have taught me far more about Prolog execution, recursion, variable environments, and backtracking than I expected.
I've written a more detailed explanation on Medium:
[Insert Medium article link here]SCBM-Prolog: Eight More Days — Let’s Keep Trying! | by Kenichi Sasagawa | Oct, 2026 | Medium
Eight more days. Let's see what happens!
r/prolog • u/schmuhblaster_x45 • Oct 09 '26
r/prolog • u/Iaroslav-Baranov • Oct 09 '26
He created so many wonderful handcrafted prolog exercises on Exercism, and I would like to say "thank you" to him and also ask several questions about the track.
I've sent a message to hello@exercism.org, but have no response. I've also tried to connect on LinkedIn, but unable to send a message there because of restriction for non-premium users.
r/prolog • u/Pzzlrr • Sep 29 '26
I thought this was interesting
Rewriting and rejection are supposed to result in a large reduction of the search tree and produce an operational semantics that is more efficient than Prolog's resolution strategy.
...
ALF programs are compiled into instructions of an abstract machine, which is based on the Warren Abstract Machine (WAM) with several extensions to implement narrowing and rewriting.
So based on the WAM and theoretically more efficient? But then the link to what I guess is/was the main developers of this system is dead, and besides a couple miscellaneous articles can't really find too much info on it besides this manual from 1995.
Is this just a dead project? Anyone know if these rewrite/narrowing optimizations they're referring to have been built into the SWI or Scryer WAM?
r/prolog • u/sym_num • Sep 23 '26
It has been about six months since I first came up with the idea of SCBM-Prolog, a Prolog compiler based on an approach quite different from the WAM.
I have never been completely satisfied with SCBM4, which I have been working on recently. I keep looking for a simpler, clearer, and more efficient approach, and as a result, I have repeatedly built and tested different versions of the design.
In Japan, we have a series of holidays around this time known as Silver Week. I spent much of the holiday experimenting with SCBM again.
After all those experiments, I have finally begun to realize that SCBM3 — an approach I had previously abandoned — may actually be the most promising one.
At the time, I encountered a problem that I simply could not overcome, and I concluded that there must be something fundamentally wrong with the design itself. So I abandoned SCBM3.
Now I am beginning to think that conclusion was wrong.
More importantly, I am finally starting to understand why SCBM3 did not work correctly at the time.
So I am returning to it once again.
Six months after starting this project, I am still experimenting, debugging, abandoning ideas, returning to old ones, and improving SCBM-Prolog little by little.
Apparently, I still haven't learned how to give up. :-)
r/prolog • u/s243a • Sep 23 '26
I've been building a mobile notebook app and the part this sub might care about is the Prolog kernel. It's the official swipl-wasm build of SWI-Prolog running inside an Android WebView, fully offline once installed. No server, no account.
What a Prolog cell does:
Directives (:- ...) run silently, assert/retract/consult are executed and confirmed, and anything else is treated as a query and all solutions are enumerated (member(X,[a,b,c]). gives you three answers).
A cell that mixes clause definitions and queries is split: the clauses are consulted as a source file, the queries run afterwards, so you can write a small program and its test query in one cell.
Files are shared with the other kernels. Prolog's native open/3 and write/1 go to Emscripten's FS, which is mirrored into a shared virtual filesystem that Python, R, Bash and JS cells also see. So a Python cell can generate facts to /shared/data/facts.pl and the next Prolog cell consults them. Everything persists in IndexedDB.
load_url('https://...', '/shared/lib/x.pl') fetches and consults a file, and a package format lets you bundle knowledge bases with a notebook.
Notebooks import and export as .ipynb, so a Prolog notebook opens in Jupyter too (as a static document).
Known limits: it's one toplevel per notebook, and swipl-wasm's foreign-library restrictions apply. Cold start is a couple of seconds on a mid-range phone.
It also runs Python, R, Bash and a few others, but that's a different post. The free edition is MIT and also runs in a desktop browser as a PWA if you want to poke at it without installing anything:
Source: https://github.com/s243a/SciREPL
Web demo: https://s243a.github.io/SciREPL/
Google Play (free): https://play.google.com/store/apps/details?id=com.unifyweaver.scirepl
Happy to answer questions about how swipl-wasm behaves in a WebView, or what breaks.
r/prolog • u/schmuhblaster_x45 • Sep 21 '26