Created
June 28, 2024 16:27
-
-
Save bhargavkulk/189be84e4bf01ad0c8df93b285b6d7b5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { strict as assert } from 'node:assert'; | |
const frmla = '(FPCore (a b c):name "quadp (p42, positive)"' + | |
"(let ([d (sqrt (- (* b b) (* 4 (* a c))))])" + | |
"(/ (+ (- b) d) (* 2 a))))" | |
const sample = (await(await fetch('http://127.0.0.1:8000/api/sample', { method: 'POST', body: JSON.stringify({ | |
formula: frmla, seed: 5 }) })).json()) | |
const SAMPLE_SIZE = 8000 | |
assert.ok(sample.points) | |
const points = sample.points | |
const alternatives = (await (await fetch('http://127.0.0.1:8000/api/alternatives', { method: 'POST', body: JSON.stringify({ | |
formula: frmla, | |
sample: points }) })).json()) | |
//console.log(alternatives) | |
const proof = alternatives.derivations[0].prev.prev.prevs[1].proof | |
proof.reverse() | |
for (const step in proof) { | |
console.log(proof[step].program) | |
console.log(proof[step].rule) | |
console.log(proof[step].loc) | |
console.log(proof[step].direction) | |
console.log('--------------------') | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment