{"_id":"@cooljapan/phop-wasm","name":"@cooljapan/phop-wasm","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@cooljapan/phop-wasm","type":"module","collaborators":["COOLJAPAN OÜ (Team KitaSan) <contact@cooljapan.tech>"],"description":"WebAssembly bindings for phop: in-browser differentiable symbolic discovery","version":"0.1.0","license":"Apache-2.0","repository":{"type":"git","url":"git+https://github.com/cool-japan/phop.git"},"main":"phop_wasm.js","homepage":"https://github.com/cool-japan/phop","types":"phop_wasm.d.ts","sideEffects":["./snippets/*"],"keywords":["symbolic-regression","machine-learning","webassembly","wasm","eml"],"_id":"@cooljapan/phop-wasm@0.1.0","gitHead":"74f9f631983809f444db68bb957e54f71e6e12a5","bugs":{"url":"https://github.com/cool-japan/phop/issues"},"_nodeVersion":"20.20.2","_npmVersion":"10.8.2","dist":{"integrity":"sha512-omGJ7ADULH7NuGeeRiy6RHsNVaMA0CQp1pAOhq0K5sdoiphwl1Jsg4lifYviuSR0baInkK8ObOnQDCBVqIx5oA==","shasum":"127e663b13166772e2692643051b89152420d3bc","tarball":"https://registry.npmjs.org/@cooljapan/phop-wasm/-/phop-wasm-0.1.0.tgz","fileCount":5,"unpackedSize":1570695,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@cooljapan%2fphop-wasm@0.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIEjdFQVLx1ZSUNHXT84m8F9beoUgdUNBtf3+Ccq9GLyRAiEAyqGTDBfozxXEqmMJfal2W0V1UlvzlW1izS3IPJ1xFWw="}]},"_npmUser":{"name":"kitasan","email":"info@kitasan.io"},"directories":{},"maintainers":[{"name":"kitasan","email":"info@kitasan.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/phop-wasm_0.1.0_1782402305138_0.7470230592447054"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-25T15:45:05.014Z","0.1.0":"2026-06-25T15:45:05.371Z","modified":"2026-06-25T15:45:05.764Z"},"maintainers":[{"name":"kitasan","email":"info@kitasan.io"}],"description":"WebAssembly bindings for phop: in-browser differentiable symbolic discovery","homepage":"https://github.com/cool-japan/phop","keywords":["symbolic-regression","machine-learning","webassembly","wasm","eml"],"repository":{"type":"git","url":"git+https://github.com/cool-japan/phop.git"},"bugs":{"url":"https://github.com/cool-japan/phop/issues"},"license":"Apache-2.0","readme":"# phop-wasm — discover **and prove** scientific laws, entirely in the browser\n\nWebAssembly bindings for [phop](https://github.com/cool-japan/phop). They turn a web page into a\ncomplete, **proof-carrying scientific-discovery environment** that never contacts a server:\n\n> **Paste data → a closed-form law is discovered → canonicalized by a CAS → its range and roots are\n> certified → and its properties are proved by an SMT solver. All of it runs in your browser tab.**\n\nNo backend. No install. Nothing is uploaded, and nothing is stored — close the tab and it is gone.\n\n![phop in-browser demo](./www/demo.svg)\n\n*Snapshot of the bundled demo on `y = eˣ`. The values shown are the actual runtime output; the two\n`Proven` verdicts are produced by the **OxiZ SMT solver running inside the browser's WASM engine**.*\n\n## Why this is hard to do anywhere else\n\nA symbolic-regression result is only trustworthy if you can *check* it. Doing that check **client-side,\noffline, with no install** requires the entire stack — the search engine, a computer-algebra system,\nan interval verifier, and a full SMT solver — to compile to WebAssembly. The mainstream tools can't:\n\n| Capability (in-browser, offline) | phop (Pure Rust → WASM) | PySR (Julia) | SymPy (Python) | Mathematica |\n|---|:--:|:--:|:--:|:--:|\n| Discover a closed-form law | ✅ | ❌ | ❌ | ❌ |\n| CAS analysis + canonicalization | ✅ | ❌ | ❌ | ❌ |\n| **Certified** range / root enclosure | ✅ | ❌ | ❌ | ❌ |\n| **SMT-proved** properties | ✅ | ❌ | ❌ | ❌ |\n| Zero server · zero install · zero trace | ✅ | ❌ | ❌ | ❌ |\n\nJulia and CPython have no browser runtime; Mathematica is proprietary and server-bound. The\nCOOLJAPAN pure-Rust ecosystem — [`oxieml`](https://crates.io/crates/oxieml) (EML-IR CAS),\n[`oxiz`](https://crates.io/crates/oxiz) (a Z3-class SMT solver), and `scirs2-symbolic` (e-graphs) —\n*all* compile to `wasm32`, so the whole pipeline ships as one ~0.9 MB (gzipped) module. To our\nknowledge no other toolchain assembles a **proof-carrying discovery environment that runs purely in\nthe browser**.\n\n## The verified pipeline (one call, all client-side)\n\n```text\ndata ─▶ discover (EML-tree + rich-leaf search)\n     ─▶ analyze    (derivative / antiderivative / Maclaurin · oxieml CAS)\n     ─▶ canonical  (equality-saturation e-graph · scirs2-symbolic)\n     ─▶ certify    (interval range enclosure + interval-Newton root · sound)\n     ─▶ prove      (SMT: \"no root in box\", \"≡ this target law\" · OxiZ)\n```\n\nReal output, captured from the compiled WASM module running the `y = eˣ` example:\n\n```\ncapabilities : analyze ✓  certify ✓  canonical ✓  smt ✓\nlaw          : eml(x0, 1)          (= eˣ⁰)        R² = 1.000000\nd/dx₀ (CAS)  : e^{x_0}\ncanonical    : e^{x_0}\ncertified    : f(x) ∈ [1, 20.0855]               (= [e⁰, e³], a *guaranteed* enclosure)\ncertified root: RootCertificate { … status: NoRoot }\nSMT no-root  : Proven                             ← OxiZ, in the browser\nSMT ≡ true   : Proven                             ← equivalence to the true law, proved in the browser\n```\n\n## Run the demo\n\n```bash\n# 1. Build the WASM package (carries discovery + CAS + e-graph + SMT)\n./crates/phop-wasm/build-wasm.sh\n\n# 2. Serve the static files (any static host works; this touches no application server)\ncd crates/phop-wasm && python3 -m http.server 8000\n\n# 3. Open the demo\n#    http://localhost:8000/www/\n```\n\nThe page ships built-in examples (exponential growth, a product law, Kepler's `T = a³ᐟ²`), a CSV box,\nand toggles for each verification tier. The capability chips light up to show exactly which tiers the\nloaded WASM build supports.\n\n## JavaScript API\n\n```js\nimport init, { discover_and_verify, capabilities, set_panic_hook } from \"./pkg/phop_wasm.js\";\n\nawait init();\nset_panic_hook();\n\nconst data = JSON.stringify({ x: [[0],[0.5],[1]], y: [1, 1.6487, 2.7183] });\nconst cfg  = JSON.stringify({\n  method: \"enumerate\",        // \"enumerate\" | \"auto\" (EML + rich-leaf) | \"rich\" (products/powers)\n  top_k: 1,\n  analyze: true,              // CAS derivative / antiderivative\n  canonical: true,            // e-graph canonical form        (needs the `egraph` feature)\n  certify: true,              // certified range + root         (always available)\n  prove_no_root: true,        // SMT: no root over the data box (needs the `smt` feature)\n  target_model: \"<json>\",     // optional: SMT-prove equivalence to a serialized EML law\n  // units: [[0,1,0,0,0,0,0], ...]   // optional: Buckingham-π reduction before discovery\n});\n\nconst result = JSON.parse(discover_and_verify(data, cfg));\nconsole.log(result.solutions[0]);   // { latex, pretty, mse, r2, certified_range, proven_no_root, ... }\n```\n\n- `capabilities()` returns `{ analyze, certify, canonical, smt }` so the UI can show only the tiers\n  this build supports.\n- `discover_json(data, cfg)` remains for the lightweight discover-only path.\n\n### Cargo features\n\n`egraph` (e-graph canonicalization) and `smt` (OxiZ proofs) are opt-in so a minimal build stays tiny;\nthe demo build enables both. The `certify` and `analyze` tiers need no feature.\n\nPublished on npm as **`@cooljapan/phop`**. Part of the [phop](https://github.com/cool-japan/phop)\nproject.\n\n## License\n\nApache-2.0\n","readmeFilename":"README.md","_rev":"1-4be6552236654e19242cd3d166cb7139"}