Spaces:
Running
Running
Download tau_engine.js from introspector/zkprologml: direct link, hf CLI and curl.
- Browser
- Download file 1.1 kB
-
https://huggingface.co/spaces/introspector/zkprologml/resolve/main/tau_engine.js
- Command line
-
hf download hf://spaces/introspector/zkprologml/tau_engine.js
-
curl -L -o tau_engine.js https://huggingface.co/spaces/introspector/zkprologml/resolve/main/tau_engine.js
1.1 kB
| // Tau-Prolog integration for zkPrologML | |
| class TauPrologEngine { | |
| constructor() { | |
| this.session = pl.create(); | |
| this.initialized = false; | |
| } | |
| async init() { | |
| // Load facts | |
| await fetch("tau_facts.js") | |
| .then(r => r.text()) | |
| .then(facts => { | |
| this.session.consult(facts); | |
| this.initialized = true; | |
| console.log("✅ Tau-Prolog initialized"); | |
| }); | |
| } | |
| query(goal) { | |
| return new Promise((resolve, reject) => { | |
| this.session.query(goal); | |
| const results = []; | |
| this.session.answers(x => { | |
| if (x === false) resolve(results); | |
| else if (pl.type.is_error(x)) reject(x); | |
| else results.push(x); | |
| }); | |
| }); | |
| } | |
| async queryShard(shard) { | |
| const goal = `by_shard(${shard}, Path)`; | |
| return await this.query(goal); | |
| } | |
| async queryLanguage(lang) { | |
| const goal = `by_language(${lang}, Path)`; | |
| return await this.query(goal); | |
| } | |
| async provenTheorems() { | |
| const goal = "proven_theorems(Name)"; | |
| return await this.query(goal); | |
| } | |
| } | |
| // Global instance | |
| const tauProlog = new TauPrologEngine(); | |