Skip to content

Instantly share code, notes, and snippets.

@bhargavkulk
Created June 28, 2024 16:27
Show Gist options
  • Save bhargavkulk/189be84e4bf01ad0c8df93b285b6d7b5 to your computer and use it in GitHub Desktop.
Save bhargavkulk/189be84e4bf01ad0c8df93b285b6d7b5 to your computer and use it in GitHub Desktop.
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