verimath 0.1.0-rc.59 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "verimath",
3
- "version": "0.1.0-rc.59",
3
+ "version": "0.1.0",
4
4
  "description": "Exact mathematical answer grading in Node.js",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/hsreika/VeriMath.git",
8
8
  "directory": "bindings-node"
9
9
  },
10
- "homepage": "https://github.com/hsreika/VeriMath/blob/main/docs/node.md",
10
+ "homepage": "https://hsreika.github.io/VeriMath/docs/node.html",
11
11
  "files": [
12
12
  "verimath.js",
13
13
  "verimath.d.ts",
package/verimath.d.ts CHANGED
@@ -22,6 +22,14 @@ export type Verdict = (
22
22
  witness: string | null;
23
23
  };
24
24
  export type Grade = (expected: string, actual: string) => Verdict;
25
+ export type MembershipWitness = {
26
+ variable: string;
27
+ /** Exact reduced rational, such as "-1/5". */
28
+ value: string;
29
+ } & ({ in_expected: true; in_actual: false } | { in_expected: false; in_actual: true });
30
+ export type Inspection =
31
+ | (Extract<Verdict, { equivalent: false }> & { counterexample: MembershipWitness | null })
32
+ | (Exclude<Verdict, { equivalent: false }> & { counterexample: null });
25
33
 
26
34
 
27
35
 
@@ -30,6 +38,12 @@ export type Grade = (expected: string, actual: string) => Verdict;
30
38
  */
31
39
  export function createVerifier(options?: VerifierOptions): Grade;
32
40
 
41
+ /**
42
+ * Grade with the supplied rules and return an exact counterexample when the
43
+ * engine can distinguish two real solution sets by a rational point.
44
+ */
45
+ export function inspect(expected: string, actual: string, options?: VerifierOptions): Inspection;
46
+
33
47
  /**
34
48
  * Compare an answer key and a submission. Ungraded answers have equivalent = null.
35
49
  */
package/verimath.js CHANGED
@@ -14,6 +14,23 @@ function createVerifier(options) {
14
14
  }
15
15
  exports.createVerifier = createVerifier;
16
16
 
17
+ /**
18
+ * Grade with the supplied rules and return an exact counterexample when the
19
+ * engine can distinguish two real solution sets by a rational point.
20
+ * @param {string} expected
21
+ * @param {string} actual
22
+ * @param {VerifierOptions} [options]
23
+ * @returns {Inspection}
24
+ */
25
+ function inspect(expected, actual, options) {
26
+ const ret = wasm.inspect(expected, actual, options);
27
+ if (ret[2]) {
28
+ throw takeFromExternrefTable0(ret[1]);
29
+ }
30
+ return takeFromExternrefTable0(ret[0]);
31
+ }
32
+ exports.inspect = inspect;
33
+
17
34
  /**
18
35
  * Compare an answer key and a submission. Ungraded answers have equivalent = null.
19
36
  * @param {string} expected
@@ -69,6 +86,10 @@ function __wbg_get_imports() {
69
86
  __wbg___wbindgen_throw_4c88d8bf264fd984: function(arg0, arg1) {
70
87
  throw new Error(getStringFromWasm0(arg0, arg1));
71
88
  },
89
+ __wbg_fromCodePoint_84793ae8d520c4b9: function() { return handleError(function (arg0) {
90
+ const ret = String.fromCodePoint(arg0 >>> 0);
91
+ return ret;
92
+ }, arguments); },
72
93
  __wbg_getPrototypeOf_8fbf04523e13de29: function() { return handleError(function (arg0) {
73
94
  const ret = Reflect.getPrototypeOf(arg0);
74
95
  return ret;
package/verimath_bg.wasm CHANGED
Binary file
@@ -2,6 +2,7 @@
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
4
  export const createVerifier: (a: any) => [number, number, number];
5
+ export const inspect: (a: any, b: any, c: any) => [number, number, number];
5
6
  export const verify: (a: any, b: any, c: any) => [number, number, number];
6
7
  export const wasm_bindgen_5250fd6ed7aeca90___convert__closures_____invoke___wasm_bindgen_5250fd6ed7aeca90___JsValue__wasm_bindgen_5250fd6ed7aeca90___JsValue__core_6a51abefd5362b2___result__Result_wasm_bindgen_5250fd6ed7aeca90___JsValue__wasm_bindgen_5250fd6ed7aeca90___JsValue___true_: (a: number, b: number, c: any, d: any) => [number, number, number];
7
8
  export const __wbindgen_malloc: (a: number, b: number) => number;