Prolog Source-to-Source Optimiser — JavaScript Web Version
Parse a Prolog program and run the optimisation pipeline: Stage 1 (Unfolding) → Stage 2 (Memoisation) → Stage 3 (Formula Simplification).
Examples:
Input Program
Optimised Output
Output will appear here…
Optimisation Report
No report yet.
Perform Gauss-Jordan elimination on an augmented matrix. Enter one row per line, values separated by spaces or commas.
Input Matrix
Augmented matrix rows (last column = RHS):
Reduced Matrix
Result will appear here…
Polynomial Fit
Sample values (comma-separated, indexed from 1):
Result will appear here…
Given a sequence of sample values, infer the closed-form polynomial formula that generates them (implements infer_sequence_formula/2).
Sequence Samples
Values (comma-separated, n=1,2,3,…):
Result will appear here…
Formula Verification
Formula (e.g. n*(n+1)/2):
Start n:
End n:
Reference function (JavaScript, receives n):
Result will appear here…
Classify each goal in a Prolog program body as safe, unsafe, or unknown (implements classify_goal_safety/2 and classify_body_safety/2).
Program
Safety Classification
Result will appear here…
Format optimisation report items into human-readable text (implements report_lines/2, report_text/2, print_report/1).
Report Items (JSON)
Enter report items as a JSON array:
Formatted Report
Result will appear here…
Stage 18 — Hierarchical Shared-Subgoal Splicing: detect predicates that call the same pure deterministic subgoal, hoist the shared computation once, and splice the remaining template bodies (implements build_dependency_graph/3, hoist_common_dependencies/4, hierarchical_splice_program/3).