eutaxy 0.17.2 → 0.19.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.
Files changed (74) hide show
  1. package/README.md +15 -12
  2. package/dist/aws.d.mts +2 -2
  3. package/dist/aws.mjs +3 -2
  4. package/dist/aws.mjs.map +1 -1
  5. package/dist/bin.mjs +1 -1
  6. package/dist/check-zkHLdWyf.mjs +1281 -0
  7. package/dist/check-zkHLdWyf.mjs.map +1 -0
  8. package/dist/cli-CNAKqV9R.mjs +297 -0
  9. package/dist/cli-CNAKqV9R.mjs.map +1 -0
  10. package/dist/cli.d.mts.map +1 -1
  11. package/dist/cli.mjs +1 -1
  12. package/dist/cloudflare.d.mts +56 -5
  13. package/dist/cloudflare.d.mts.map +1 -1
  14. package/dist/cloudflare.mjs +6417 -3
  15. package/dist/cloudflare.mjs.map +1 -0
  16. package/dist/{delivery-invariants-DO3j1mmD.mjs → delivery-invariants-BJDck0K8.mjs} +2 -2
  17. package/dist/{delivery-invariants-DO3j1mmD.mjs.map → delivery-invariants-BJDck0K8.mjs.map} +1 -1
  18. package/dist/{delivery-invariants-D7DI7i8x.d.mts → delivery-invariants-C3GXJIbg.d.mts} +2 -2
  19. package/dist/{delivery-invariants-D7DI7i8x.d.mts.map → delivery-invariants-C3GXJIbg.d.mts.map} +1 -1
  20. package/dist/draft-DEUDffHa.mjs +467 -0
  21. package/dist/draft-DEUDffHa.mjs.map +1 -0
  22. package/dist/{src-fxWc6oGc.mjs → generate-TBJM3-2P.mjs} +3 -574
  23. package/dist/generate-TBJM3-2P.mjs.map +1 -0
  24. package/dist/index.d.mts +45 -37
  25. package/dist/index.d.mts.map +1 -1
  26. package/dist/index.mjs +7 -4
  27. package/dist/index.mjs.map +1 -1
  28. package/dist/install-DkzpGA5D.mjs +611 -0
  29. package/dist/install-DkzpGA5D.mjs.map +1 -0
  30. package/dist/{explore-CkKiOuz6.d.mts → ir-KpC2epGn.d.mts} +88 -53
  31. package/dist/ir-KpC2epGn.d.mts.map +1 -0
  32. package/dist/keys-xtanNmuR.mjs +111 -0
  33. package/dist/keys-xtanNmuR.mjs.map +1 -0
  34. package/dist/mcp-B64Ko6y7.mjs +539 -0
  35. package/dist/mcp-B64Ko6y7.mjs.map +1 -0
  36. package/dist/{platform-D4hlJjm3.d.mts → platform-Cs9V9t2k.d.mts} +92 -11
  37. package/dist/platform-Cs9V9t2k.d.mts.map +1 -0
  38. package/dist/pool-CXN4CwGY.mjs +61 -0
  39. package/dist/pool-CXN4CwGY.mjs.map +1 -0
  40. package/dist/{provers-DS44OeEm.mjs → provers-D8VaY_OM.mjs} +18 -2
  41. package/dist/provers-D8VaY_OM.mjs.map +1 -0
  42. package/dist/reader-B9FSoEYW.mjs +1 -0
  43. package/dist/reader-Cz6_bLf6.mjs +3774 -0
  44. package/dist/reader-Cz6_bLf6.mjs.map +1 -0
  45. package/dist/report-_Vzavqg0.mjs +310 -0
  46. package/dist/report-_Vzavqg0.mjs.map +1 -0
  47. package/dist/src-B2DpVbMN.mjs +2 -0
  48. package/dist/src-BFGTvuA_.mjs +1235 -0
  49. package/dist/src-BFGTvuA_.mjs.map +1 -0
  50. package/dist/src-BtLZPRyG.mjs +120 -0
  51. package/dist/src-BtLZPRyG.mjs.map +1 -0
  52. package/dist/src-CB8DcvsK.mjs +1 -0
  53. package/dist/src-COuquJvI.mjs +269 -0
  54. package/dist/src-COuquJvI.mjs.map +1 -0
  55. package/dist/src-Chn-m_r1.mjs +1082 -0
  56. package/dist/src-Chn-m_r1.mjs.map +1 -0
  57. package/dist/src-DwYD3QQJ.mjs +346 -0
  58. package/dist/src-DwYD3QQJ.mjs.map +1 -0
  59. package/dist/{src-D_hHC_-3.mjs → src-Dx4QvrQb.mjs} +945 -548
  60. package/dist/src-Dx4QvrQb.mjs.map +1 -0
  61. package/dist/toolchain-DWfymxAJ.mjs +80 -0
  62. package/dist/toolchain-DWfymxAJ.mjs.map +1 -0
  63. package/dist/verdict-evEM5Gxx.mjs +12 -0
  64. package/dist/verdict-evEM5Gxx.mjs.map +1 -0
  65. package/package.json +4 -1
  66. package/dist/cli-B0Gs2mhT.mjs +0 -9445
  67. package/dist/cli-B0Gs2mhT.mjs.map +0 -1
  68. package/dist/explore-CkKiOuz6.d.mts.map +0 -1
  69. package/dist/platform-D4hlJjm3.d.mts.map +0 -1
  70. package/dist/provers-DS44OeEm.mjs.map +0 -1
  71. package/dist/src-D_hHC_-3.mjs.map +0 -1
  72. package/dist/src-fxWc6oGc.mjs.map +0 -1
  73. package/dist/workerd-DhrzU6AZ.mjs +0 -6300
  74. package/dist/workerd-DhrzU6AZ.mjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-TBJM3-2P.mjs","names":["digits"],"sources":["../../spec/src/ir.ts","../../prover/src/regex-gen.ts","../../prover/src/render.ts","../../prover/src/generate.ts"],"sourcesContent":["/**\n * SpecIR: function specs as plain data. The surface is TypeScript (a spec\n * file beside the module, `forall(f, { when, ensures })` and `total(f)`\n * from `eutaxy/spec`); the IR is Eutaxy's own, so the simulator's rungs\n * and every engine read one shape. Binder domains are the function's\n * parameter types, read from its declaration; the precondition and the\n * claim are kept as the arrow functions' text, read by each engine into\n * its own tree, and evaluated as code by the simulator's rungs.\n */\n\n/** A TypeScript type as far as the reader can read it; `unknown` carries what it could not. */\nexport type SpecType =\n | { readonly kind: \"number\" }\n | { readonly kind: \"boolean\" }\n | { readonly kind: \"string\" }\n | { readonly kind: \"bigint\" }\n | { readonly kind: \"literal\"; readonly value: string | number | boolean }\n | { readonly kind: \"null\" }\n | { readonly kind: \"undefined\" }\n | {\n readonly kind: \"record\";\n /** The declared name, when the type is an `interface` or a `type` alias rather than inline. */\n readonly name?: string;\n readonly fields: readonly Field[];\n }\n | { readonly kind: \"union\"; readonly members: readonly SpecType[] }\n /** `T[]`, `readonly T[]`, `Array<T>` or `ReadonlyArray<T>`: a JavaScript array, read-only or not. */\n | { readonly kind: \"array\"; readonly element: SpecType }\n | { readonly kind: \"unknown\"; readonly text: string };\n\nexport interface Field {\n readonly name: string;\n readonly type: SpecType;\n}\n\n/** One end of a numeric range: the literal as written (sign included). `[` and `]` include the endpoint. */\nexport interface Endpoint {\n readonly value: string;\n readonly inclusive: boolean;\n}\n\n/**\n * What the precondition says about one binder on its own, read from its\n * conjuncts: `Number.isInteger(n)`, `0 <= n`, `n < 5`, `/^a+$/.test(s)`.\n * Draws are steered by it; the precondition itself still has the last word.\n */\nexport interface Hint {\n readonly integer?: true;\n readonly lower?: Endpoint;\n readonly upper?: Endpoint;\n readonly regex?: { readonly pattern: string; readonly flags: string };\n}\n\n/** A parameter of the function under spec. */\nexport interface Param {\n /** Null for a destructured or rest parameter. */\n readonly name: string | null;\n readonly type: SpecType;\n}\n\n/** A quantified variable: a parameter, under the name the claim gives it. */\nexport interface Binder {\n readonly name: string;\n readonly type: SpecType;\n readonly hint?: Hint;\n}\n\n/** An arrow function from the spec file, as written. */\nexport interface Arrow {\n /** Parameter names in order; null for a destructured one. */\n readonly params: readonly (string | null)[];\n /** The body's source text: an expression, or the statements between the braces when `block`. */\n readonly body: string;\n readonly block: boolean;\n /** 1-based line of the arrow in the spec file. */\n readonly line: number;\n}\n\n/**\n * One exported spec: `forall(f, { when, ensures })`, a universally\n * quantified claim over `f`'s parameters where the precondition holds, or\n * `total(f)`, that `f` terminates on every input.\n */\nexport interface Property {\n /** The export's name in the spec file. */\n readonly name: string;\n readonly kind: \"forall\" | \"total\";\n /** The parameters, named as `ensures` names them (the function's own names past its arity). */\n readonly binders: readonly Binder[];\n /** Where the `TESTED` rung draws inputs; not part of the claim (see `Forall`). */\n readonly sample?: Arrow;\n readonly when?: Arrow;\n readonly ensures?: Arrow;\n /**\n * The module's functions the spec file imports, by the local name the\n * arrows use: a claim's free names resolve here, never in the module.\n */\n readonly imports: readonly { readonly local: string; readonly fn: string }[];\n /** The claim as written, for reports. */\n readonly text: string;\n /** 1-based line of the export in the spec file. */\n readonly line: number;\n}\n\n/** The specs on one exported function. */\nexport interface FunctionSpec {\n readonly name: string;\n readonly params: readonly Param[];\n readonly properties: readonly Property[];\n /** 1-based line of the declaration in the module. */\n readonly line: number;\n /** Offset in the module's source of the `(` opening the parameters: the declaration's identity. */\n readonly offset: number;\n}\n\n/** A problem with a spec, located in the spec file (or the module when `inModule`). */\nexport interface SpecError {\n readonly line: number;\n readonly message: string;\n readonly inModule?: true;\n}\n\n/** Every spec of one module, and what did not read. */\nexport interface ModuleSpecs {\n readonly functions: readonly FunctionSpec[];\n readonly errors: readonly SpecError[];\n}\n\n/** A type, for messages. */\nexport function describeType(t: SpecType): string {\n switch (t.kind) {\n case \"number\":\n case \"boolean\":\n case \"string\":\n case \"bigint\":\n case \"null\":\n case \"undefined\":\n return t.kind;\n case \"literal\":\n return typeof t.value === \"string\" ? JSON.stringify(t.value) : String(t.value);\n case \"record\":\n return (\n t.name ?? `{ ${t.fields.map((f) => `${f.name}: ${describeType(f.type)}`).join(\"; \")} }`\n );\n case \"union\":\n return t.members.map(describeType).join(\" | \");\n case \"array\":\n return t.element.kind === \"union\"\n ? `(${describeType(t.element)})[]`\n : `${describeType(t.element)}[]`;\n case \"unknown\":\n return t.text;\n }\n}\n","/**\n * Strings that match a regular expression, drawn with core's seeded\n * generator: the pattern is parsed into alternatives, sequences, classes\n * and quantified terms, and each draw walks that tree. The subset is what\n * guards use: literals, escapes, classes with ranges and negation, groups,\n * alternation, the usual quantifiers and anchors. Lookaround,\n * backreferences and Unicode property escapes are refused with\n * `UnsupportedRegex`, and the caller falls back to sampling. Every draw is\n * checked against the real `RegExp` by the caller, so a gap here can only\n * cost a draw, never admit a value outside the guard.\n */\n\nimport { nextInt, type PrngState } from \"@eutaxy/core\";\n\nexport class UnsupportedRegex extends Error {}\n\ntype Node =\n | { readonly kind: \"alt\"; readonly options: readonly Node[] }\n | { readonly kind: \"seq\"; readonly items: readonly Node[] }\n | { readonly kind: \"repeat\"; readonly item: Node; readonly min: number; readonly max: number }\n | { readonly kind: \"class\"; readonly pool: readonly string[] }\n | { readonly kind: \"literal\"; readonly text: string }\n | { readonly kind: \"empty\" };\n\nconst digits = [...\"0123456789\"];\nconst word = [...\"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_\"];\nconst space = [...\" \\t\\n\\r\\f\\v\"];\n/** What `.` and negated classes draw from: printable ASCII, a few others, no newline. */\nconst anyChar = [\n ...\" !\\\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\\]^_`abcdefghijklmnopqrstuvwxyz{|}~üß日\",\n];\n\n/** A plentiful count for an unbounded quantifier: keeps drawn strings short. */\nconst unboundedExtra = 4;\n/** The most a counted quantifier may ask for; a guard wanting more is left to sampling. */\nconst maxRepeat = 1000;\n/** The longest string one draw may build before it is given up. */\nconst maxLength = 10_000;\n/** The most nodes one draw may visit: nested repetitions of empty matches multiply work without length. */\nconst maxSteps = 100_000;\n\n/** A class node over the characters it can draw; negation is resolved here, once. */\nfunction classNode(chars: readonly string[], negated: boolean): Node {\n const pool = negated ? anyChar.filter((c) => !chars.includes(c)) : chars;\n if (pool.length === 0) throw new UnsupportedRegex(\"an empty class matches nothing\");\n return { kind: \"class\", pool };\n}\n\nclass Parser {\n private at = 0;\n private readonly src: string;\n private readonly dotAll: boolean;\n private readonly unicode: boolean;\n constructor(src: string, flags: string) {\n this.src = src;\n this.dotAll = flags.includes(\"s\");\n this.unicode = flags.includes(\"u\");\n }\n\n parse(): Node {\n const node = this.alternation();\n if (this.at < this.src.length) throw new UnsupportedRegex(`unexpected ${this.src[this.at]}`);\n return node;\n }\n\n private peek(): string | undefined {\n return this.src[this.at];\n }\n\n private take(): string {\n const c = this.src[this.at++];\n if (c === undefined) throw new UnsupportedRegex(\"pattern ends early\");\n return c;\n }\n\n private alternation(): Node {\n const options = [this.sequence()];\n while (this.peek() === \"|\") {\n this.at++;\n options.push(this.sequence());\n }\n return options.length === 1 ? (options[0] as Node) : { kind: \"alt\", options };\n }\n\n private sequence(): Node {\n const items: Node[] = [];\n while (this.at < this.src.length && this.peek() !== \"|\" && this.peek() !== \")\") {\n const atom = this.atom();\n items.push(this.quantified(atom));\n }\n return items.length === 1 ? (items[0] as Node) : { kind: \"seq\", items };\n }\n\n private quantified(atom: Node): Node {\n const c = this.peek();\n let min: number;\n let max: number;\n if (c === \"*\") [min, max] = [0, unboundedExtra];\n else if (c === \"+\") [min, max] = [1, 1 + unboundedExtra];\n else if (c === \"?\") [min, max] = [0, 1];\n else if (c === \"{\") {\n const m = /^\\{(\\d+)(,(\\d*))?\\}/.exec(this.src.slice(this.at));\n if (!m) return atom; // a literal brace\n min = Number(m[1]);\n max =\n m[2] === undefined\n ? min\n : m[3] === \"\" || m[3] === undefined\n ? min + unboundedExtra\n : Number(m[3]);\n if (max < min) throw new UnsupportedRegex(`quantifier {${min},${max}} is empty`);\n if (max > maxRepeat)\n throw new UnsupportedRegex(`quantifier {${min},${max}} repeats too much to draw`);\n this.at += m[0].length - 1;\n } else return atom;\n this.at++;\n if (this.peek() === \"?\") this.at++; // lazy: same language\n return { kind: \"repeat\", item: atom, min, max };\n }\n\n private atom(): Node {\n const c = this.take();\n switch (c) {\n case \"(\": {\n if (this.src.startsWith(\"?:\", this.at)) this.at += 2;\n else if (\n this.src.startsWith(\"?<\", this.at) &&\n !\"=!\".includes(this.src[this.at + 2] ?? \"\")\n ) {\n const close = this.src.indexOf(\">\", this.at);\n if (close < 0) throw new UnsupportedRegex(\"unterminated group name\");\n this.at = close + 1;\n } else if (this.peek() === \"?\") throw new UnsupportedRegex(\"lookaround or modifier group\");\n const inner = this.alternation();\n if (this.take() !== \")\") throw new UnsupportedRegex(\"unbalanced parenthesis\");\n return inner;\n }\n case \"[\":\n return this.charClass();\n case \".\":\n return classNode(this.dotAll ? [...anyChar, \"\\n\"] : anyChar, false);\n case \"^\":\n case \"$\":\n return { kind: \"empty\" };\n case \"\\\\\":\n return this.escape(false);\n case \")\":\n case \"|\":\n case \"*\":\n case \"+\":\n case \"?\":\n throw new UnsupportedRegex(`unexpected ${c}`);\n default:\n return { kind: \"literal\", text: c };\n }\n }\n\n /** An escape after `\\`; inside a class, `\\b` is a backspace. */\n private escape(inClass: boolean): Node {\n const e = this.take();\n switch (e) {\n case \"d\":\n return classNode(digits, false);\n case \"D\":\n return classNode(digits, true);\n case \"w\":\n return classNode(word, false);\n case \"W\":\n return classNode(word, true);\n case \"s\":\n return classNode(space, false);\n case \"S\":\n return classNode(space, true);\n case \"n\":\n return { kind: \"literal\", text: \"\\n\" };\n case \"t\":\n return { kind: \"literal\", text: \"\\t\" };\n case \"r\":\n return { kind: \"literal\", text: \"\\r\" };\n case \"f\":\n return { kind: \"literal\", text: \"\\f\" };\n case \"v\":\n return { kind: \"literal\", text: \"\\v\" };\n case \"0\":\n return { kind: \"literal\", text: \"\\0\" };\n case \"b\":\n if (inClass) return { kind: \"literal\", text: \"\\b\" };\n return { kind: \"empty\" };\n case \"B\":\n return { kind: \"empty\" };\n case \"x\": {\n const hex = this.src.slice(this.at, this.at + 2);\n if (!/^[0-9a-fA-F]{2}$/.test(hex)) throw new UnsupportedRegex(\"bad \\\\x escape\");\n this.at += 2;\n return { kind: \"literal\", text: String.fromCharCode(Number.parseInt(hex, 16)) };\n }\n case \"u\": {\n if (this.peek() === \"{\") {\n // Without the u flag, \\u{43} is the letter u 43 times.\n if (!this.unicode) throw new UnsupportedRegex(\"\\\\u{} without the u flag\");\n const close = this.src.indexOf(\"}\", this.at);\n const hex = this.src.slice(this.at + 1, close);\n if (close < 0 || !/^[0-9a-fA-F]{1,6}$/.test(hex))\n throw new UnsupportedRegex(\"bad \\\\u escape\");\n this.at = close + 1;\n return { kind: \"literal\", text: String.fromCodePoint(Number.parseInt(hex, 16)) };\n }\n const hex = this.src.slice(this.at, this.at + 4);\n if (!/^[0-9a-fA-F]{4}$/.test(hex)) throw new UnsupportedRegex(\"bad \\\\u escape\");\n this.at += 4;\n return { kind: \"literal\", text: String.fromCharCode(Number.parseInt(hex, 16)) };\n }\n case \"p\":\n case \"P\":\n case \"k\":\n case \"c\":\n throw new UnsupportedRegex(`\\\\${e} escapes`);\n default:\n if (/[1-9]/.test(e)) throw new UnsupportedRegex(\"backreferences\");\n return { kind: \"literal\", text: e };\n }\n }\n\n /** `[...]` after its opening bracket. `[]` is empty and `[]a]` is an empty class then `a]`, as in JavaScript. */\n private charClass(): Node {\n let negated = false;\n if (this.peek() === \"^\") {\n negated = true;\n this.at++;\n }\n const chars = new Set<string>();\n while (this.peek() !== \"]\") {\n const c = this.take();\n let member: string;\n if (c === \"\\\\\") {\n const node = this.escape(true);\n if (node.kind === \"class\") {\n // \\d inside a class adds its members; \\D its complement, already resolved over anyChar.\n for (const x of node.pool) chars.add(x);\n continue;\n }\n if (node.kind !== \"literal\") throw new UnsupportedRegex(\"escape in class\");\n member = node.text;\n } else member = c;\n if (\n this.peek() === \"-\" &&\n this.src[this.at + 1] !== \"]\" &&\n this.src[this.at + 1] !== undefined\n ) {\n this.at++;\n const to =\n this.take() === \"\\\\\"\n ? this.escape(true)\n : { kind: \"literal\" as const, text: this.src[this.at - 1] as string };\n if (to.kind !== \"literal\") throw new UnsupportedRegex(\"range to a class\");\n const lo = member.codePointAt(0) as number;\n const hi = to.text.codePointAt(0) as number;\n if (hi < lo) throw new UnsupportedRegex(\"range out of order\");\n if (hi - lo > 0x2000) throw new UnsupportedRegex(\"range too wide to enumerate\");\n for (let p = lo; p <= hi; p++) chars.add(String.fromCodePoint(p));\n continue;\n }\n chars.add(member);\n }\n this.at++;\n return classNode([...chars], negated);\n }\n}\n\n/** The pattern as a tree, or `UnsupportedRegex`. */\nexport function parseRegex(pattern: string, flags: string): Node {\n if (flags.includes(\"v\")) throw new UnsupportedRegex(\"the v flag\");\n return new Parser(pattern, flags).parse();\n}\n\n/** One string from the tree, with the state that follows. */\nexport function drawRegex(node: Node, state: PrngState): readonly [string, PrngState] {\n let s = state;\n let steps = 0;\n const go = (n: Node): string => {\n if (++steps > maxSteps) throw new UnsupportedRegex(\"a draw visited more than 100000 nodes\");\n switch (n.kind) {\n case \"empty\":\n return \"\";\n case \"literal\":\n return n.text;\n case \"alt\": {\n const [i, next] = nextInt(s, n.options.length);\n s = next;\n return go(n.options[i] as Node);\n }\n case \"seq\":\n return n.items.map(go).join(\"\");\n case \"repeat\": {\n const [extra, next] = nextInt(s, n.max - n.min + 1);\n s = next;\n let out = \"\";\n for (let i = 0; i < n.min + extra; i++) {\n out += go(n.item);\n if (out.length > maxLength)\n throw new UnsupportedRegex(\"a draw grew past 10000 characters\");\n }\n return out;\n }\n case \"class\": {\n const [i, next] = nextInt(s, n.pool.length);\n s = next;\n return n.pool[i] as string;\n }\n }\n };\n return [go(node), s];\n}\n","/**\n * A value as a JavaScript literal: exact for the primitive types (bigints\n * included, `-0` and `NaN` kept), records and arrays spelled as literals,\n * so a counterexample reads back as what it was. Never truncated and never\n * throwing: the rungs key distinct inputs by it, so two values must render\n * alike only when they are alike.\n */\nexport function render(value: unknown): string {\n return renderAt(value, new Set());\n}\n\nfunction renderAt(value: unknown, seen: Set<object>): string {\n switch (typeof value) {\n case \"bigint\":\n return `${value}n`;\n case \"number\":\n return Object.is(value, -0) ? \"-0\" : String(value);\n case \"string\":\n return JSON.stringify(value);\n case \"undefined\":\n return \"undefined\";\n case \"boolean\":\n return String(value);\n case \"function\":\n return \"[function]\";\n case \"symbol\":\n return String(value);\n }\n if (value === null) return \"null\";\n const o = value as object;\n if (seen.has(o)) return \"<cycle>\";\n seen.add(o);\n try {\n if (Array.isArray(o)) return `[${o.map((x) => renderAt(x, seen)).join(\", \")}]`;\n if (o instanceof Date)\n return Number.isNaN(o.getTime()) ? \"Date(NaN)\" : `Date(${JSON.stringify(o.toISOString())})`;\n if (o instanceof Map)\n return `Map([${[...o].map(([k, v]) => `[${renderAt(k, seen)}, ${renderAt(v, seen)}]`).join(\", \")}])`;\n if (o instanceof Set) return `Set([${[...o].map((x) => renderAt(x, seen)).join(\", \")}])`;\n const entries = Object.entries(o).map(\n ([k, v]) =>\n `${/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(k) ? k : JSON.stringify(k)}: ${renderAt(v, seen)}`,\n );\n return entries.length === 0 ? \"{}\" : `{ ${entries.join(\", \")} }`;\n } catch {\n // A throwing getter or an exotic object: something, never a throw out of a verdict.\n try {\n return `<${String(o)}>`;\n } catch {\n return \"<unrenderable>\";\n }\n } finally {\n seen.delete(o);\n }\n}\n\n/** Whether two values render alike: structural equality that tells `1n` from `1` and `-0` from `0`. */\nexport function same(a: unknown, b: unknown): boolean {\n return typeof a === typeof b && render(a) === render(b);\n}\n\n/**\n * A deep copy of plain data: arrays and records (plain objects); anything\n * else (a Date the simulator passed, a class instance) is kept as it is.\n * Each evaluation of a property gets its own, so code under test that\n * mutates an input (`xs.sort()`) changes neither the printed counterexample\n * nor the candidates built from it, and no two places in an input share an\n * object, as their printed literals do not.\n */\nexport function copy<T>(v: T): T {\n if (Array.isArray(v)) return v.map(copy) as T;\n if (v !== null && typeof v === \"object\") {\n const proto = Object.getPrototypeOf(v);\n if (proto !== Object.prototype && proto !== null) return v;\n return Object.fromEntries(Object.entries(v).map(([k, x]) => [k, copy(x)])) as T;\n }\n return v;\n}\n","/**\n * Inputs for the `TESTED` rung: values drawn from a binder's type, steered\n * by what the precondition says about it, with core's seeded generator;\n * and the smaller values a shrinker tries in place of one that broke a\n * property. Everything here is pure: the same state draws the same value,\n * so a `TESTED` verdict and its counterexample come out the same on every\n * machine.\n */\n\nimport { nextFloat, nextInt, nextU32, type PrngState } from \"@eutaxy/core\";\nimport { type Binder, describeType, type Endpoint, type Hint, type SpecType } from \"@eutaxy/spec\";\nimport { drawRegex, parseRegex, UnsupportedRegex } from \"./regex-gen.ts\";\nimport { copy, render, same } from \"./render.ts\";\n\n/** A value and the state that follows drawing it. */\nexport type Draw<T> = readonly [T, PrngState];\n\n/** Thrown when no value could be drawn: `unsupported` for a type the rung cannot draw, `gave_up` for a range nothing lies in. */\nexport class CannotGenerate extends Error {\n readonly why: \"unsupported\" | \"gave_up\";\n constructor(why: \"unsupported\" | \"gave_up\", message: string) {\n super(message);\n this.why = why;\n }\n}\n\n/** Integers are drawn as doubles, so they stay exact. */\nconst safe = 2n ** 53n - 1n;\n\n/** How far an unguarded side of a bigint range reaches. */\nconst bigintReach = 1n << 128n;\n\n/** A finite endpoint's value as a double. */\nexport function endpointNumber(value: string): number {\n return Number(value.replace(/_/g, \"\").replace(/n$/, \"\"));\n}\n\n/**\n * The integers a bound admits, as the bound itself: `n < 5` admits up to 4,\n * `n <= 5` up to 5, `n < 4.5` up to 4; `0 < n` from 1, `-0.5 <= n` from 0.\n */\nexport function integerBound(e: Endpoint, side: \"lower\" | \"upper\"): bigint | undefined {\n const text = e.value.replace(/_/g, \"\").replace(/n$/, \"\");\n if (/[.eE]/.test(text)) {\n const n = Number(text);\n // A literal past every double (`1e400`) bounds nothing an integer can reach.\n if (!Number.isFinite(n)) return undefined;\n if (!Number.isInteger(n)) return BigInt(side === \"lower\" ? Math.ceil(n) : Math.floor(n));\n return BigInt(n) + (e.inclusive ? 0n : side === \"lower\" ? 1n : -1n);\n }\n return BigInt(text) + (e.inclusive ? 0n : side === \"lower\" ? 1n : -1n);\n}\n\n/** A finite integral endpoint's value, exact: underscores and the `n` suffix dropped. */\nexport function endpointBigInt(value: string): bigint {\n return BigInt(value.replace(/_/g, \"\").replace(/n$/, \"\"));\n}\n\n/**\n * The closed integer interval a hint admits: within what a double holds\n * exactly for `number`; for `bigint`, the hint's ends, an unhinted side\n * reaching 2^128 past the other. Undefined when no integer lies in it.\n */\nfunction integerRange(\n kind: \"number\" | \"bigint\",\n hint: Hint | undefined,\n): { readonly lo: bigint; readonly hi: bigint } | undefined {\n const guardLo = hint?.lower === undefined ? undefined : integerBound(hint.lower, \"lower\");\n const guardHi = hint?.upper === undefined ? undefined : integerBound(hint.upper, \"upper\");\n let lo: bigint;\n let hi: bigint;\n if (kind === \"bigint\") {\n lo =\n guardLo ?? (guardHi === undefined ? -bigintReach : min(-bigintReach, guardHi - bigintReach));\n hi = guardHi ?? (guardLo === undefined ? bigintReach : max(bigintReach, guardLo + bigintReach));\n } else {\n lo = max(-safe, guardLo ?? -safe);\n hi = min(safe, guardHi ?? safe);\n }\n return lo <= hi ? { lo, hi } : undefined;\n}\n\nconst max = (a: bigint, b: bigint) => (a > b ? a : b);\nconst min = (a: bigint, b: bigint) => (a < b ? a : b);\n\n/** Uniform in [lo, hi], however wide: enough 32-bit words, masked, rejected when past the span. */\nexport function uniformBigInt(lo: bigint, hi: bigint, state: PrngState): Draw<bigint> {\n const span = hi - lo + 1n;\n if (span <= 0n) throw new RangeError(`empty integer interval [${lo}, ${hi}]`);\n if (span === 1n) return [lo, state];\n let bits = 0;\n for (let x = span - 1n; x > 0n; x >>= 1n) bits++;\n const words = Math.ceil(bits / 32);\n const mask = (1n << BigInt(bits)) - 1n;\n let s = state;\n for (;;) {\n let r = 0n;\n for (let i = 0; i < words; i++) {\n const [u, next] = nextU32(s);\n s = next;\n r = (r << 32n) | BigInt(u);\n }\n r &= mask;\n if (r < span) return [lo + r, s];\n }\n}\n\n/** One of a list, uniformly. */\nfunction pick<T>(items: readonly T[], state: PrngState): Draw<T> {\n const [i, s] = nextInt(state, items.length);\n return [items[i] as T, s];\n}\n\n/**\n * An integer from the range, biased: most draws are small, since\n * properties fail at boundaries and small cases far more often than deep in\n * the range, some are medium or large, and a few are the range's edges.\n */\n/** An integer range's edges, as the random draws pick from them (repeats kept, so draws stay as they were). */\nfunction integerEdgeCandidates(lo: bigint, hi: bigint): bigint[] {\n return [lo, hi, 0n, 1n, -1n, lo + 1n, hi - 1n].filter((v) => v >= lo && v <= hi);\n}\n\nfunction drawInteger(\n name: string,\n kind: \"number\" | \"bigint\",\n hint: Hint | undefined,\n state: PrngState,\n): Draw<bigint> {\n const range = integerRange(kind, hint);\n if (!range)\n throw new CannotGenerate(\n \"gave_up\",\n kind === \"bigint\"\n ? `no integer lies inside the precondition's bounds on ${name}`\n : `no integer lies inside the precondition's bounds on ${name} within ±2^53, which is as far as draws of number go`,\n );\n const { lo, hi } = range;\n const [cls, s] = nextInt(state, 100);\n const within = (a: bigint, z: bigint): [bigint, bigint] | undefined => {\n const l = max(lo, a);\n const h = min(hi, z);\n return l <= h ? [l, h] : undefined;\n };\n if (cls < 5) return pick(integerEdgeCandidates(lo, hi), s);\n const bound =\n cls < 55\n ? within(-16n, 16n)\n : cls < 80\n ? within(-(1n << 16n), 1n << 16n)\n : cls < 95\n ? within(-(1n << 31n), 1n << 31n)\n : undefined;\n const [l, h] = bound ?? [lo, hi];\n return uniformBigInt(l, h, s);\n}\n\n/** The double interval a hint admits. */\nfunction numberRange(hint: Hint | undefined): {\n readonly lo: number;\n readonly hi: number;\n readonly guarded: boolean;\n} {\n const lo =\n hint?.lower === undefined ? Number.NEGATIVE_INFINITY : endpointNumber(hint.lower.value);\n const hi =\n hint?.upper === undefined ? Number.POSITIVE_INFINITY : endpointNumber(hint.upper.value);\n return { lo, hi, guarded: hint?.lower !== undefined || hint?.upper !== undefined };\n}\n\n/** Whether a double satisfies the hint's bounds (NaN satisfies none). */\nfunction withinNumberHint(hint: Hint | undefined, v: number): boolean {\n if (!hint) return true;\n if (hint.integer && !Number.isInteger(v)) return false;\n if (hint.lower) {\n const lo = endpointNumber(hint.lower.value);\n if (!(hint.lower.inclusive ? v >= lo : v > lo)) return false;\n }\n if (hint.upper) {\n const hi = endpointNumber(hint.upper.value);\n if (!(hint.upper.inclusive ? v <= hi : v < hi)) return false;\n }\n return true;\n}\n\n/** A double hint's edges, as the random draws pick from them. */\nfunction doubleEdgeCandidates(hint: Hint | undefined): number[] {\n const { lo, hi, guarded } = numberRange(hint);\n return [\n 0,\n -0,\n 1,\n -1,\n 0.5,\n Number.MIN_VALUE,\n Number.EPSILON,\n Number.MAX_VALUE,\n -Number.MAX_VALUE,\n Number.POSITIVE_INFINITY,\n Number.NEGATIVE_INFINITY,\n ...(guarded ? [lo, hi] : [Number.NaN]),\n ].filter((v) => withinNumberHint(hint, v));\n}\n\nfunction drawNumber(hint: Hint | undefined, state: PrngState): Draw<number> {\n const { lo, hi } = numberRange(hint);\n const [cls, s0] = nextInt(state, 100);\n if (cls < 8) {\n const edges = doubleEdgeCandidates(hint);\n if (edges.length > 0) return pick(edges, s0);\n }\n if (cls < 35) {\n const [k, s1] = nextInt(s0, 33);\n return [k - 16, s1];\n }\n if (cls < 60) {\n const [d, s1] = pick([2, 4, 8, 10, 100], s0);\n const [k, s2] = nextInt(s1, 65);\n return [(k - 32) / d, s2];\n }\n if (cls < 80 && Number.isFinite(lo) && Number.isFinite(hi)) {\n const [f, s1] = nextFloat(s0);\n return [lo + f * (hi - lo), s1];\n }\n // Any magnitude a double holds: a random mantissa at a random binary exponent, either sign.\n const [f, s1] = nextFloat(s0);\n const [e, s2] = nextInt(s1, 2100);\n const [neg, s3] = nextInt(s2, 2);\n return [(neg ? -1 : 1) * (1 + f) * 2 ** (e - 1074), s3];\n}\n\nconst letters = \"abcdefghijklmnopqrstuvwxyz\";\nconst digits = \"0123456789\";\nconst plainAlphabet = [...`${letters}${letters.toUpperCase()}${digits} _-.,:/\\n'\"üß日😀`];\nconst stringEdges = [\"\", \" \", \"a\", \"0\", \"-1\", \"\\n\", \"\\u0000\", \"ü\", \"😀\", \"a\".repeat(100)];\n/** The longest string sampled over a regex's own characters, and the longest edge a regex is tried on. */\nconst regexSampleLength = 12;\n\n/**\n * The characters a regex names: literals, the ranges and escapes of its\n * classes. Strings drawn from them match the pattern far more often than\n * strings drawn from everything, which is what the rejection below needs.\n */\nexport function regexAlphabet(pattern: string): string[] {\n const chars = new Set<string>();\n const add = (s: string) => {\n for (const c of s) chars.add(c);\n };\n for (let i = 0; i < pattern.length; i++) {\n const c = pattern[i] as string;\n if (c === \"\\\\\") {\n const e = pattern[++i];\n if (e === \"d\") add(digits);\n else if (e === \"w\") add(`${letters}${letters.toUpperCase()}${digits}_`);\n else if (e === \"s\") add(\" \");\n else if (e === \"n\") add(\"\\n\");\n else if (e === \"t\") add(\"\\t\");\n else if (e !== undefined && !/[DWSbBuxpP]/.test(e)) add(e);\n continue;\n }\n if (pattern[i + 1] === \"-\" && i + 2 < pattern.length && pattern[i + 2] !== \"]\") {\n const from = c.codePointAt(0) as number;\n const to = (pattern[i + 2] as string).codePointAt(0) as number;\n if (from < to && to - from <= 0x1000)\n for (let p = from; p <= to; p++) chars.add(String.fromCodePoint(p));\n i += 2;\n continue;\n }\n if (!\"^$()[]{}|*+?.-\".includes(c)) chars.add(c);\n }\n return [...chars];\n}\n\n/** A string of `length` characters from `alphabet`. */\nfunction drawChars(alphabet: readonly string[], length: number, state: PrngState): Draw<string> {\n let s = state;\n let out = \"\";\n for (let i = 0; i < length; i++) {\n const [c, next] = pick(alphabet, s);\n s = next;\n out += c;\n }\n return [out, s];\n}\n\n/** Whether a string passes the hint's regex (the real RegExp has the last word). */\nfunction matchesRegex(hint: Hint | undefined, v: string): boolean {\n return hint?.regex === undefined || new RegExp(hint.regex.pattern, hint.regex.flags).test(v);\n}\n\nfunction drawString(hint: Hint | undefined, state: PrngState): Draw<string> {\n const g = hint?.regex;\n if (!g) {\n const [cls, s0] = nextInt(state, 100);\n if (cls < 15) return pick(stringEdges, s0);\n const [length, s1] = nextInt(s0, 25);\n return drawChars(plainAlphabet, length, s1);\n }\n let s = state;\n // Walk the pattern when it is in the understood subset; the real RegExp has the last word.\n let tree: ReturnType<typeof parseRegex> | undefined;\n try {\n tree = parseRegex(g.pattern, g.flags);\n } catch (err) {\n if (!(err instanceof UnsupportedRegex)) throw err;\n }\n for (let attempt = 0; tree && attempt < 16; attempt++) {\n try {\n const [candidate, s1] = drawRegex(tree, s);\n s = s1;\n if (matchesRegex(hint, candidate)) return [candidate, s];\n } catch (err) {\n if (!(err instanceof UnsupportedRegex)) throw err;\n break;\n }\n }\n // Otherwise sample strings over the pattern's own characters and keep what matches.\n const fromPattern = regexAlphabet(g.pattern);\n const alphabet = fromPattern.length > 0 ? fromPattern : plainAlphabet;\n for (let attempt = 0; attempt < 64; attempt++) {\n const [length, s1] = nextInt(s, regexSampleLength + 1);\n const [candidate, s2] = drawChars(alphabet, length, s1);\n s = s2;\n if (matchesRegex(hint, candidate)) return [candidate, s];\n }\n throw new CannotGenerate(\n \"gave_up\",\n `no string matching /${g.pattern}/${g.flags} was found in 64 draws over its characters`,\n );\n}\n\n/** The most shrink candidates one array offers at a step; the shrinker evaluates 500 in all. */\nconst shrinkCandidateLimit = 256;\n\n/** The most edges a record type has; random draws cover its other combinations. */\nconst recordEdgeLimit = 64;\n\n/** Without repeats, in one pass, as `same` compares: 0 and -0 stay apart, two empty arrays do not. */\nfunction distinct<T>(values: readonly T[]): T[] {\n const seen = new Set<string>();\n return values.filter((v) => {\n const key = `${typeof v}:${render(v)}`;\n if (seen.has(key)) return false;\n seen.add(key);\n return true;\n });\n}\n\nfunction integerEdges(kind: \"number\" | \"bigint\", hint: Hint | undefined): bigint[] {\n const range = integerRange(kind, hint);\n return range ? distinct(integerEdgeCandidates(range.lo, range.hi)) : [];\n}\n\n/**\n * How many combinations of these edge lists to take side by side: the\n * longest list's length, twice over when there are two or more lists,\n * since `combined` walks them once in step (equal edges meet, as\n * `Infinity - Infinity` needs) and once rotated (list `k` starting `k`\n * places in, so lists of one type also differ).\n */\nfunction combinations(lists: readonly (readonly unknown[])[]): number {\n const longest = Math.max(0, ...lists.map((l) => l.length));\n return lists.length > 1 ? 2 * longest : longest;\n}\n\n/** List `k`'s value in the `i`-th combination. */\nfunction combined<T>(lists: readonly (readonly T[])[], k: number, i: number): T {\n const longest = Math.max(...lists.map((l) => l.length));\n const own = lists[k] as readonly T[];\n const offset = i < longest ? 0 : k;\n return own[((i % longest) + offset) % own.length] as T;\n}\n\n/**\n * The values of a type, within the hint, that properties fail on far more\n * often than elsewhere: the bounds, zero and one, the double specials (NaN,\n * the infinities, -0), the empty string, both booleans, every member of a\n * union, and records built field by field from those. The `TESTED` rung\n * tries every one before any random draw, so a claim false on one value\n * is found under every seed; a claim false only on a combination of edges\n * across binders or fields is found where the rotation below pairs them,\n * and otherwise rests on the random draws. A type with none (a string\n * whose regex no edge matches) gives none.\n */\nexport function edgesOf(type: SpecType, hint: Hint | undefined): unknown[] {\n switch (type.kind) {\n case \"boolean\":\n return [false, true];\n case \"number\": {\n // Number.isInteger(-0) holds, so -0 is an integer edge wherever 0 is one.\n if (hint?.integer)\n return integerEdges(\"number\", hint).flatMap((v) => (v === 0n ? [0, -0] : [Number(v)]));\n return distinct(doubleEdgeCandidates(hint));\n }\n case \"bigint\":\n return integerEdges(\"bigint\", hint);\n case \"string\":\n // A regex is tried only on edges as short as the strings sampled over its characters: a\n // backtracking pattern on the 100-character edge could run for longer than the check.\n return stringEdges.filter(\n (v) =>\n hint?.regex === undefined || (v.length <= regexSampleLength && matchesRegex(hint, v)),\n );\n case \"literal\":\n return [type.value];\n case \"null\":\n return [null];\n case \"undefined\":\n return [undefined];\n case \"union\":\n return distinct(type.members.flatMap((m) => edgesOf(m, undefined)));\n case \"record\": {\n // Distinct records only, and at most recordEdgeLimit of them: nested records multiply their\n // fields' edges, and a record's edges must not grow with its depth.\n const lists = type.fields.map((f) => edgesOf(f.type, undefined));\n if (lists.some((l) => l.length === 0)) return [];\n const out: Record<string, unknown>[] = [];\n const seen = new Set<string>();\n for (let i = 0; i < Math.max(1, combinations(lists)) && out.length < recordEdgeLimit; i++) {\n const r = Object.fromEntries(type.fields.map((f, k) => [f.name, combined(lists, k, i)]));\n const key = render(r);\n if (seen.has(key)) continue;\n seen.add(key);\n out.push(r);\n }\n return out;\n }\n case \"array\": {\n // Empty, one of each element edge, and one element twice: claims about arrays break on the\n // empty one and on repeats far more often than elsewhere.\n if (!drawable(type.element)) return [];\n const element = edgesOf(type.element, undefined);\n return [\n [],\n ...element.map((e) => [e]),\n ...(element.length > 0 ? [[element[0], element[0]]] : []),\n ];\n }\n case \"unknown\":\n return [];\n }\n}\n\n/** Each binder's edges, computed once for a property's whole edge phase. */\nexport function edgeLists(binders: readonly Binder[]): unknown[][] {\n return binders.map((b) => edgesOf(b.type, b.hint));\n}\n\n/** How many edge assignments the binders' `edgeLists` give. */\nexport function edgeAssignmentCount(edges: readonly (readonly unknown[])[]): number {\n return combinations(edges);\n}\n\n/**\n * The `i`-th edge assignment from the binders' `edgeLists`: the lists\n * walked once in step and once rotated (binder `j` starting `j` places\n * in), cycling, so each edge of each binder appears, equal edges meet and\n * binders of one type also differ; a binder with no edges is drawn at\n * random. Undefined from `edgeAssignmentCount` on.\n */\nexport function edgeAssignment(\n binders: readonly Binder[],\n edges: readonly (readonly unknown[])[],\n i: number,\n state: PrngState,\n): Draw<unknown[]> | undefined {\n if (i >= combinations(edges)) return undefined;\n const values: unknown[] = [];\n let s = state;\n binders.forEach((b, j) => {\n const own = edges[j] as readonly unknown[];\n if (own.length > 0) {\n values.push(copy(combined(edges, j, i)));\n return;\n }\n const [v, next] = generate(b, s);\n s = next;\n values.push(v);\n });\n return [values, s];\n}\n\n/** Whether every part of the type is one the rung draws (no `unknown` anywhere in it). */\nfunction drawable(type: SpecType): boolean {\n switch (type.kind) {\n case \"unknown\":\n return false;\n case \"array\":\n return drawable(type.element);\n case \"union\":\n return type.members.every(drawable);\n case \"record\":\n return type.fields.every((f) => drawable(f.type));\n default:\n return true;\n }\n}\n\n/** A value of the type, within the hint (which applies to a top-level binder only). */\nexport function generateOf(\n name: string,\n type: SpecType,\n hint: Hint | undefined,\n state: PrngState,\n): Draw<unknown> {\n switch (type.kind) {\n case \"boolean\": {\n const [bit, s] = nextInt(state, 2);\n return [bit === 1, s];\n }\n case \"number\": {\n if (hint?.integer) {\n const [v, s] = drawInteger(name, \"number\", hint, state);\n return [Number(v), s];\n }\n let s = state;\n for (let attempt = 0; attempt < 64; attempt++) {\n const [v, next] = drawNumber(hint, s);\n s = next;\n if (withinNumberHint(hint, v)) return [v, s];\n }\n throw new CannotGenerate(\n \"gave_up\",\n `no number inside the precondition's bounds on ${name} was found in 64 draws`,\n );\n }\n case \"bigint\":\n return drawInteger(name, \"bigint\", hint, state);\n case \"string\":\n return drawString(hint, state);\n case \"literal\":\n return [type.value, state];\n case \"null\":\n return [null, state];\n case \"undefined\":\n return [undefined, state];\n case \"union\": {\n const [member, s] = pick(type.members, state);\n return generateOf(name, member, undefined, s);\n }\n case \"record\": {\n let s = state;\n const out: Record<string, unknown> = {};\n for (const f of type.fields) {\n const [v, next] = generateOf(`${name}.${f.name}`, f.type, undefined, s);\n s = next;\n out[f.name] = v;\n }\n return [out, s];\n }\n case \"array\": {\n // Refused whatever length is drawn, as an unreadable parameter type is: an empty draw must\n // not make an array of something unreadable look testable.\n if (!drawable(type.element))\n throw new CannotGenerate(\n \"unsupported\",\n `${name} has a type the rung cannot draw from: ${describeType(type)}`,\n );\n // Mostly short (up to 4), sometimes up to 16; an element repeats an earlier one a quarter of\n // the time, since a claim keyed on distinct elements breaks on a repeat.\n const [cls, s0] = nextInt(state, 100);\n const [length, s1] = nextInt(s0, cls < 70 ? 5 : 17);\n let s = s1;\n const out: unknown[] = [];\n for (let i = 0; i < length; i++) {\n if (out.length > 0) {\n const [repeat, s2] = nextInt(s, 4);\n s = s2;\n if (repeat === 0) {\n const [v, s3] = pick(out, s);\n s = s3;\n out.push(copy(v));\n continue;\n }\n }\n const [v, next] = generateOf(`${name}[${i}]`, type.element, undefined, s);\n s = next;\n out.push(v);\n }\n return [out, s];\n }\n case \"unknown\":\n throw new CannotGenerate(\n \"unsupported\",\n `${name} has a type the rung cannot draw from: ${describeType(type)}`,\n );\n }\n}\n\n/** A value of the binder's type, within its hint. */\nexport function generate(b: Binder, state: PrngState): Draw<unknown> {\n return generateOf(b.name, b.type, b.hint, state);\n}\n\n/** Whether a binder draws integers (or bigints), which later binders may relate to. */\nfunction integral(b: Binder): boolean {\n return b.type.kind === \"bigint\" || (b.type.kind === \"number\" && b.hint?.integer === true);\n}\n\n/**\n * One assignment to every binder. Each is drawn from its own type and\n * hint; a later integer binder is sometimes made to relate to earlier\n * ones instead, equal to one or the sum or difference of two, since\n * preconditions relate binders (`refunded + amount === captured`) and\n * independent draws would meet such an equation once in thousands. A\n * related value outside the binder's hint is dropped for the draw.\n */\nexport function generateAssignment(binders: readonly Binder[], state: PrngState): Draw<unknown[]> {\n const values: unknown[] = [];\n let s = state;\n for (const b of binders) {\n const [drawn, next] = generate(b, s);\n s = next;\n let v = drawn;\n const earlier = values.filter(\n (x, i) => integral(binders[i] as Binder) && typeof x === typeof drawn,\n );\n if (integral(b) && earlier.length > 0) {\n const [cls, s1] = nextInt(s, 10);\n s = s1;\n if (cls < 3) {\n const [a, s2] = pick(earlier, s1);\n const [c, s3] = pick(earlier, s2);\n s = s3;\n let related: unknown = a;\n if (cls === 1)\n related =\n typeof a === \"bigint\" ? (a as bigint) + (c as bigint) : (a as number) + (c as number);\n if (cls === 2)\n related =\n typeof a === \"bigint\" ? (a as bigint) - (c as bigint) : (a as number) - (c as number);\n if (inDomain(b, related) && (typeof related !== \"number\" || Number.isSafeInteger(related)))\n v = related;\n }\n }\n values.push(v);\n }\n return [values, s];\n}\n\n/** Whether a value is of the type (hints aside). */\nexport function conforms(type: SpecType, v: unknown): boolean {\n switch (type.kind) {\n case \"number\":\n return typeof v === \"number\";\n case \"boolean\":\n return typeof v === \"boolean\";\n case \"string\":\n return typeof v === \"string\";\n case \"bigint\":\n return typeof v === \"bigint\";\n case \"literal\":\n // `===`: -0 is of the literal type 0, as TypeScript has it.\n return v === type.value;\n case \"null\":\n return v === null;\n case \"undefined\":\n return v === undefined;\n case \"union\":\n return type.members.some((m) => conforms(m, v));\n case \"record\":\n return (\n typeof v === \"object\" &&\n v !== null &&\n type.fields.every((f) => conforms(f.type, (v as Record<string, unknown>)[f.name]))\n );\n case \"array\":\n // A sparse array is outside: JavaScript's array methods skip its holes, a list has none.\n if (!Array.isArray(v)) return false;\n for (let i = 0; i < v.length; i++)\n if (!(i in v) || !conforms(type.element, v[i])) return false;\n return true;\n case \"unknown\":\n return true;\n }\n}\n\n/** Whether a top-level value is of the binder's type and within its hint. */\nexport function inDomain(b: Binder, v: unknown): boolean {\n if (!conforms(b.type, v)) return false;\n const h = b.hint;\n if (!h) return true;\n if (typeof v === \"number\") return withinNumberHint(h, v);\n if (typeof v === \"bigint\") {\n const lo = h.lower && integerBound(h.lower, \"lower\");\n const hi = h.upper && integerBound(h.upper, \"upper\");\n if (lo !== undefined && v < lo) return false;\n if (hi !== undefined && v > hi) return false;\n return true;\n }\n if (typeof v === \"string\") return matchesRegex(h, v);\n return true;\n}\n\n/** The integer nearest to zero in [lo, hi]. */\nfunction nearestZero(lo: bigint, hi: bigint): bigint {\n return lo > 0n ? lo : hi < 0n ? hi : 0n;\n}\n\n/** Steps from `v` toward `target`: the target itself, then the halfway points back toward `v`. */\nfunction towards(v: bigint, target: bigint): bigint[] {\n const out: bigint[] = [];\n if (v === target) return out;\n out.push(target);\n let d = (v - target) / 2n;\n while (d !== 0n) {\n out.push(v - d);\n d /= 2n;\n }\n return out;\n}\n\n/**\n * Smaller values to try in place of `v`, simplest first, all of the type\n * and within the hint, none equal to `v`. Numbers move toward zero (or the\n * bound nearest it), strings get shorter and plainer, `true` becomes\n * `false`, a union moves to its simplest member, a record shrinks one\n * field at a time.\n */\nexport function shrinkCandidates(b: Binder, v: unknown): unknown[] {\n return candidatesOf(b.type, b.hint, v).filter((c) => !Object.is(c, v) && inDomain(b, c));\n}\n\nfunction candidatesOf(type: SpecType, hint: Hint | undefined, v: unknown): unknown[] {\n // Keyed as `same` compares, in one pass: nested arrays give thousands of candidates.\n const dedupe = (xs: unknown[]) => {\n const keys = new Set<string>();\n return xs.filter((x) => {\n const key = `${typeof x}:${render(x)}`;\n if (keys.has(key)) return false;\n keys.add(key);\n return true;\n });\n };\n switch (type.kind) {\n case \"boolean\":\n return [false];\n case \"number\": {\n if (typeof v !== \"number\") return [];\n // -0 is as small as 0 to every comparison, so only the sign is left to shrink.\n if (Object.is(v, -0)) return [0];\n if (hint?.integer || Number.isInteger(v)) {\n const range = integerRange(\"number\", hint);\n if (!Number.isInteger(v) || !range) return [];\n return dedupe(towards(BigInt(v), nearestZero(range.lo, range.hi)).map(Number));\n }\n const { lo, hi } = numberRange(hint);\n const target = lo > 0 ? lo : Math.min(hi, 0);\n if (!Number.isFinite(v)) return [target, 1, -1, Number.MAX_VALUE, -Number.MAX_VALUE];\n const out = [target, Math.trunc(v)];\n let d = (v - target) / 2;\n for (let i = 0; i < 24 && d !== 0; i++) {\n out.push(v - d);\n d /= 2;\n }\n return dedupe(out);\n }\n case \"bigint\": {\n const range = integerRange(\"bigint\", hint);\n if (typeof v !== \"bigint\" || !range) return [];\n return towards(v, nearestZero(range.lo, range.hi));\n }\n case \"string\": {\n if (typeof v !== \"string\") return [];\n const chars = [...v];\n const out: string[] = [\"\", chars.slice(0, Math.floor(chars.length / 2)).join(\"\")];\n out.push(chars.slice(Math.ceil(chars.length / 2)).join(\"\"));\n for (const at of [0, chars.length - 1, Math.floor(chars.length / 2)])\n out.push([...chars.slice(0, at), ...chars.slice(at + 1)].join(\"\"));\n const first = chars.findIndex((c) => c !== \"a\");\n if (first >= 0) out.push([...chars.slice(0, first), \"a\", ...chars.slice(first + 1)].join(\"\"));\n return dedupe(out);\n }\n case \"array\": {\n // Shorter first (empty, then one element dropped), then elements smaller: one at a time, and\n // every copy of a value at once, so a repeat that breaks the claim survives the shrink.\n // At most shrinkCandidateLimit, in that order: nested arrays have more candidates than the\n // shrinker will ever evaluate, and building them all costs seconds.\n if (!Array.isArray(v)) return [];\n const out: unknown[] = v.length > 0 ? [[]] : [];\n for (let i = 0; i < v.length; i++) out.push(v.filter((_, j) => j !== i));\n const keys = v.map((x) => `${typeof x}:${render(x)}`);\n for (let i = 0; i < v.length && out.length < shrinkCandidateLimit; i++) {\n const own = keys[i];\n const repeated = keys.some((k, j) => j !== i && k === own);\n for (const c of candidatesOf(type.element, undefined, v[i])) {\n if (out.length >= shrinkCandidateLimit) break;\n if (`${typeof c}:${render(c)}` === own) continue;\n out.push(v.map((x, j) => (j === i ? c : x)));\n if (repeated) out.push(v.map((x, j) => (keys[j] === own ? copy(c) : x)));\n }\n }\n return dedupe(out).slice(0, shrinkCandidateLimit);\n }\n case \"literal\":\n case \"null\":\n case \"undefined\":\n case \"unknown\":\n return [];\n case \"union\": {\n // The simplest value of each member first (null, false, 0, \"\", the first literal), then within v's own member.\n const simplest = type.members.flatMap((m): unknown[] => {\n switch (m.kind) {\n case \"null\":\n return [null];\n case \"undefined\":\n return [undefined];\n case \"boolean\":\n return [false];\n case \"number\":\n return [0];\n case \"bigint\":\n return [0n];\n case \"string\":\n return [\"\"];\n case \"literal\":\n return [m.value];\n default:\n return [];\n }\n });\n const own = type.members.find((m) => conforms(m, v));\n return dedupe([...simplest, ...(own ? candidatesOf(own, undefined, v) : [])]);\n }\n case \"record\": {\n if (typeof v !== \"object\" || v === null) return [];\n const o = v as Record<string, unknown>;\n const out: unknown[] = [];\n for (const f of type.fields)\n for (const c of candidatesOf(f.type, undefined, o[f.name]))\n if (!same(c, o[f.name])) out.push({ ...o, [f.name]: c });\n return out;\n }\n }\n}\n"],"mappings":";;;AAiIA,SAAgB,aAAa,GAAqB;CAChD,QAAQ,EAAE,MAAV;EACE,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK,aACH,OAAO,EAAE;EACX,KAAK,WACH,OAAO,OAAO,EAAE,UAAU,WAAW,KAAK,UAAU,EAAE,KAAK,IAAI,OAAO,EAAE,KAAK;EAC/E,KAAK,UACH,OACE,EAAE,QAAQ,KAAK,EAAE,OAAO,KAAK,MAAM,GAAG,EAAE,KAAK,IAAI,aAAa,EAAE,IAAI,GAAG,CAAC,CAAC,KAAK,IAAI,EAAE;EAExF,KAAK,SACH,OAAO,EAAE,QAAQ,IAAI,YAAY,CAAC,CAAC,KAAK,KAAK;EAC/C,KAAK,SACH,OAAO,EAAE,QAAQ,SAAS,UACtB,IAAI,aAAa,EAAE,OAAO,EAAE,OAC5B,GAAG,aAAa,EAAE,OAAO,EAAE;EACjC,KAAK,WACH,OAAO,EA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;EACL,KAAK;EACL,KAAK,WACH,OAAO,CAAC;EACV,KAAK,SAAS;GAEZ,MAAM,WAAW,KAAK,QAAQ,SAAS,MAAiB;IACtD,QAAQ,EAAE,MAAV;KACE,KAAK,QACH,OAAO,CAAC,IAAI;KACd,KAAK,aACH,OAAO,CAAC,KAAA,CAAS;KACnB,KAAK,WACH,OAAO,CAAC,KAAK;KACf,KAAK,UACH,OAAO,CAAC,CAAC;KACX,KAAK,UACH,OAAO,CAAC,EAAE;KACZ,KAAK,UACH,OAAO,CAAC,EAAE;KACZ,KAAK,WACH,OAAO,CAAC,EAAE,KAAK;KACjB,SACE,OAAO,CAAC;IACZ;GACF,CAAC;GACD,MAAM,MAAM,KAAK,QAAQ,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC;GACnD,OAAO,OAAO,CAAC,GAAG,UAAU,GAAI,MAAM,aAAa,KAAK,KAAA,GAAW,CAAC,IAAI,CAAC,CAAE,CAAC;EAC9E;EACA,KAAK,UAAU;GACb,IAAI,OAAO,MAAM,YAAY,MAAM,MAAM,OAAO,CAAC;GACjD,MAAM,IAAI;GACV,MAAM,MAAiB,CAAC;GACxB,KAAK,MAAM,KAAK,KAAK,QACnB,KAAK,MAAM,KAAK,aAAa,EAAE,MAAM,KAAA,GAAW,EAAE,EAAE,KAAK,GACvD,IAAI,CAAC,KAAK,GAAG,EAAE,EAAE,KAAK,GAAG,IAAI,KAAK;IAAE,GAAG;KAAI,EAAE,OAAO;GAAE,CAAC;GAC3D,OAAO;EACT;CACF;AACF"}
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as EffectSelector, D as FaultKind, E as FaultDecision, O as Schedule, S as Refines, T as EffectRecord, _ as Implies, b as StateQuery, d as AtMostOncePerKey, f as Invariant, g as EveryRow, h as checkInvariants, l as validateScenario, m as checkInvariant, n as Platform, o as ScenarioSpec, p as Violation, r as Bounds, t as EventRef, u as AtLeastOnce, w as EffectLog, x as Unique, y as RowCondition } from "./platform-D4hlJjm3.mjs";
2
- import { _ as describeVerdict, a as Binder, c as ModuleSpecs, d as SpecType, f as Bounded, g as Violated, h as Unsupported, i as Arrow, l as Property, m as ScenarioVerdict, n as explore, o as FunctionSpec, p as BoundsReached, r as replay, s as Hint, t as ExploreOptions, u as SpecError } from "./explore-CkKiOuz6.mjs";
1
+ import { A as FaultKind, C as Refines, D as EffectRecord, E as EffectLog, O as FaultSite, S as Unique, T as EffectSelector, _ as EveryRow, b as RowCondition, d as PinnedSchedule, f as AtLeastOnce, g as checkInvariants, h as checkInvariant, j as Schedule, k as FaultDecision, l as validateScenario, m as Invariant, n as Platform, o as ScenarioSpec, p as AtMostOncePerKey, r as Bounds, t as EventRef, u as PinnedFault, v as Implies, w as Violation, x as StateQuery } from "./platform-Cs9V9t2k.mjs";
2
+ import { _ as Unsupported, a as ModuleSpecs, c as SpecType, d as explore, f as replay, g as ScenarioVerdict, h as BoundsReached, i as Hint, l as ExploreOptions, m as Bounded, n as Binder, o as Property, p as runPinned, r as FunctionSpec, s as SpecError, t as Arrow, u as PinnedRun, v as Violated, y as describeVerdict } from "./ir-KpC2epGn.mjs";
3
3
  import { n as Forall, t as Fn } from "./combinators-BecOKcmi.mjs";
4
4
  /**
5
5
  * Spec verdicts: what is known about one property of one pure function.
@@ -98,6 +98,40 @@ interface SpecUnknown extends SpecVerdictBase {
98
98
  type SpecVerdict = Checked | Tested | Proven | Refuted | Conflict | SpecUnknown;
99
99
  /** One line per spec verdict, for error messages; full rendering lives in `report`. */
100
100
  export declare function describeSpecVerdict(v: SpecVerdict): string;
101
+ /**
102
+ * Observe a module's pure core functions while runs are installed: each call
103
+ * from outside the module is recorded with its arguments, for spec checks
104
+ * on the inputs the simulator passed, and logged as a decision of the
105
+ * invocation that made it (`Core:<function>`, payload `{ args, result }` or
106
+ * `{ args, error }`), for `refines`. Calls the module makes to itself do not
107
+ * go through its exports and are not seen.
108
+ *
109
+ * Observing replaces the export on the module's namespace object, which
110
+ * works where a bundler or test runner gives modules a namespace with
111
+ * configurable properties (Vite, so Vitest and the Cloudflare plugin); a
112
+ * native ESM namespace is frozen, and the function is reported unobservable.
113
+ */
114
+ /** One call of an observed core function from outside its module: the function, its arguments, whether it threw. */
115
+ interface ObservedCall {
116
+ readonly function: string;
117
+ /** The arguments as passed; primitives exactly, objects by reference. */
118
+ readonly args: readonly unknown[];
119
+ readonly threw: boolean;
120
+ }
121
+ /** The calls an `observeCore` has recorded, the functions it could not observe, and how to undo it. */
122
+ interface CoreObserver {
123
+ readonly calls: readonly ObservedCall[];
124
+ /** Functions that could not be observed, with why. */
125
+ readonly unobservable: {
126
+ readonly [fn: string]: string;
127
+ };
128
+ /** Put the original exports back. Safe to call twice. */
129
+ restore(): void;
130
+ }
131
+ /** Observe the named exports of a module's namespace while runs are installed; see the module comment. */
132
+ export declare function observeCore(namespace: object, functions: readonly string[]): CoreObserver;
133
+ /** The scenario restricted to the kept events, with per-message invariants re-derived. */
134
+ export declare function restrictSpec(platform: Platform, spec: ScenarioSpec, keepIds: readonly string[]): ScenarioSpec;
101
135
  interface CheckedInput {
102
136
  readonly module: string;
103
137
  readonly fn: FunctionSpec;
@@ -225,40 +259,6 @@ interface EngineReport {
225
259
  * function leaves the verdict as it was, with why among the assumptions.
226
260
  */
227
261
  export declare function aggregate(module: string, verdicts: readonly SpecVerdict[], reports: readonly EngineReport[]): SpecVerdict[];
228
- /**
229
- * Observe a module's pure core functions while runs are installed: each call
230
- * from outside the module is recorded with its arguments, for spec checks
231
- * on the inputs the simulator passed, and logged as a decision of the
232
- * invocation that made it (`Core:<function>`, payload `{ args, result }` or
233
- * `{ args, error }`), for `refines`. Calls the module makes to itself do not
234
- * go through its exports and are not seen.
235
- *
236
- * Observing replaces the export on the module's namespace object, which
237
- * works where a bundler or test runner gives modules a namespace with
238
- * configurable properties (Vite, so Vitest and the Cloudflare plugin); a
239
- * native ESM namespace is frozen, and the function is reported unobservable.
240
- */
241
- /** One call of an observed core function from outside its module: the function, its arguments, whether it threw. */
242
- interface ObservedCall {
243
- readonly function: string;
244
- /** The arguments as passed; primitives exactly, objects by reference. */
245
- readonly args: readonly unknown[];
246
- readonly threw: boolean;
247
- }
248
- /** The calls an `observeCore` has recorded, the functions it could not observe, and how to undo it. */
249
- interface CoreObserver {
250
- readonly calls: readonly ObservedCall[];
251
- /** Functions that could not be observed, with why. */
252
- readonly unobservable: {
253
- readonly [fn: string]: string;
254
- };
255
- /** Put the original exports back. Safe to call twice. */
256
- restore(): void;
257
- }
258
- /** Observe the named exports of a module's namespace while runs are installed; see the module comment. */
259
- export declare function observeCore(namespace: object, functions: readonly string[]): CoreObserver;
260
- /** The scenario restricted to the kept events, with per-message invariants re-derived. */
261
- export declare function restrictSpec(platform: Platform, spec: ScenarioSpec, keepIds: readonly string[]): ScenarioSpec;
262
262
  /** What the emitted test imports, the expressions for its platform and scenario, and what it expects. */
263
263
  interface RegressionTestOptions {
264
264
  /** Import lines for the scenario, the platform's dependencies, and anything the platform expression needs. */
@@ -285,6 +285,14 @@ interface RegressionTestOptions {
285
285
  * there and passes once it is fixed.
286
286
  */
287
287
  export declare function emitRegressionTest(verdict: Violated, options: RegressionTestOptions): string;
288
+ /**
289
+ * A Vitest test file that replays the run that made a check `UNSUPPORTED`, as its verdict's `replay`
290
+ * names it (each fault at the call it hit, by target, op, arguments and call number), and expects
291
+ * the run to place every fault and reach the same reason: a reproduction to look into, which fails
292
+ * once the run no longer gets there. Only for `unsupported_api`, which one run reaches again (other
293
+ * causes throw). `engineModule` as for `emitRegressionTest`; it exports `runPinned`.
294
+ */
295
+ export declare function emitUnsupportedTest(verdict: Unsupported, options: Omit<RegressionTestOptions, "expect">): string;
288
296
  /**
289
297
  * The JSON report: one object, canonical, with a schema version at the top.
290
298
  * Spec verdicts, when there are any, sit beside the scenario's, never in it.
@@ -299,5 +307,5 @@ export declare function renderTrace(log: EffectLog, evidence?: readonly number[]
299
307
  * scenario that could not be decided the schedule of the run that reached that.
300
308
  */
301
309
  export declare function renderText(verdict: ScenarioVerdict): string;
302
- export { type Arrow, type AtLeastOnce, type AtMostOncePerKey, type Binder, type Bounded, type Bounds, type BoundsReached, type Checked, type Conflict, type CoreObserver, type Counterexample, type EffectLog, type EffectRecord, type EffectSelector, type EngineId, type EngineReport, type EventRef, type EveryRow, type ExploreOptions, type FaultDecision, type FaultKind, type FunctionSpec, type Hint, type Implies, type Invariant, type LadderOptions, type ModuleProofs, type ModuleSpecs, type ObservedCall, type Platform, type ProofOutcome, type Property, type PropertyProof, type ProveInput, type Proven, type Prover, type Refines, type Refuted, type RegressionTestOptions, type RowCondition, type ScenarioSpec, type ScenarioVerdict, type Schedule, type SpecType, type SpecUnknown, type SpecVerdict, type StateQuery, type Tested, type TestedOptions, type Unique, type Unsupported, type Violated, type Violation, checkInvariant, checkInvariants, describeVerdict, explore, replay, validateScenario };
310
+ export { type Arrow, type AtLeastOnce, type AtMostOncePerKey, type Binder, type Bounded, type Bounds, type BoundsReached, type Checked, type Conflict, type CoreObserver, type Counterexample, type EffectLog, type EffectRecord, type EffectSelector, type EngineId, type EngineReport, type EventRef, type EveryRow, type ExploreOptions, type FaultDecision, type FaultKind, type FaultSite, type FunctionSpec, type Hint, type Implies, type Invariant, type LadderOptions, type ModuleProofs, type ModuleSpecs, type ObservedCall, type PinnedFault, type PinnedRun, type PinnedSchedule, type Platform, type ProofOutcome, type Property, type PropertyProof, type ProveInput, type Proven, type Prover, type Refines, type Refuted, type RegressionTestOptions, type RowCondition, type ScenarioSpec, type ScenarioVerdict, type Schedule, type SpecType, type SpecUnknown, type SpecVerdict, type StateQuery, type Tested, type TestedOptions, type Unique, type Unsupported, type Violated, type Violation, checkInvariant, checkInvariants, describeVerdict, explore, replay, runPinned, validateScenario };
303
311
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../../core/src/spec-verdict.ts","../../prover/src/checked.ts","../../prover/src/tested.ts","../../prover/src/ladder.ts","../../prover/src/provers.ts","../../engine/src/observe.ts","../../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;;;;;;;wBAYH,UACd,gBACA,mBAAmB,eACnB,kBAAkB,iBACjB;;;;;;;;;;;;;;;UCzFc;WACN;;WAEA;WACA;;;UAIM;WACN,gBAAgB;;WAEhB;cAA0B;;;EAEnC;;;wBAIc,YAAY,mBAAmB,+BAA+B;;wBCE9D,aACd,UAAU,UACV,MAAM,cACN,6BACC;;UC5Bc;;WAEN;;WAEA;;WAEA;;WAEA;WACA;;;;;;WAMA;aACE;aACA;;;;;;;wBAQG,mBAAmB,SAAS,UAAU,SAAS;;;;;wBCnB/C,WAAW,SAAS,iBAAiB,iBAAgB;;wBAarD,YAAY,gBAAgB;;wBA6G5B,YAAY,KAAK,WAAW;;;;;wBAkC5B,WAAW,SAAS"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../core/src/spec-verdict.ts","../../engine/src/observe.ts","../../engine/src/shrink.ts","../../prover/src/checked.ts","../../prover/src/tested.ts","../../prover/src/ladder.ts","../../prover/src/provers.ts","../../report/src/regression.ts","../../report/src/render.ts"],"mappings":";;;;;;;;;;UAQU;;WAEC;WACA;;WAEA;;WAEA;WACA;;;UAIM,gBAAgB;WACtB;;WAEA;;WAEA;;;UAIM,eAAe;WACrB;;WAEA;;WAEA;;WAEA;;WAEA;;;UAIM;;WAEN;aAA6B;aAAuB;;;WAEpD;;WAEA;;;UAIM,gBAAgB;WACtB;;WAEA;;WAEA;aAAoB;aAAuB;;WAC3C,gBAAgB;;;UAIV,eAAe;WACrB;WACA;aAAmB;aAAuB;;;WAE1C;;WAEA;;;UAIM,iBAAiB;WACvB;WACA;aAAmB;aAAuB;;WAC1C;aACE;aACA;aACA,iBAAiB;;;KAIlB;;UAGK,oBAAoB;WAC1B;WACA,OAAO;WACP;;;KAIC,cAAc,UAAU,SAAS,SAAS,UAAU,WAAW;;wBAG3D,oBAAoB,GAAG;;;;;;;;;;;;;;;UC5EtB;WACN;;WAEA;WACA;;;UAIM;WACN,gBAAgB;;WAEhB;cAA0B;;;EAEnC;;;wBAIc,YAAY,mBAAmB,+BAA+B;;wBCE9D,aACd,UAAU,UACV,MAAM,cACN,6BACC;UCwBc;WACN;WACA,IAAI;WACJ,UAAU;;WAEV;aAA2B;;;WAE3B,MAAM,OAAO;;WAEb;;;wBAIK,YAAY,OAAO,eAAe;;UCvDjC;;WAEN;;WAEA;;UAGM,oBAAoB;WAC1B;WACA,IAAI;WACJ,UAAU;;WAEV,MAAM,OAAO;;;wBAIR,WAAW,OAAO,cAAc;;UC3B/B;;WAEN,SAAS;;WAET;;;wBAIK,WAAW,OAAO,cAAc,UAAS,gBAAqB;;UCL7D;WACN;WACA;;;KAIC;WACG;WAAyB,QAAQ;WAAmB;;WAEpD;WACA,QAAQ;WACR,iBAAiB;WACjB;;WAGA;WACA;WACA;;;UAYE;WACN;;WAEA;WACA,SAAS;;;UAIH;WACN;WACA;;WAEA;;WAEA;;;UAIM;WACN,kBAAkB;;WAElB,qBAAqB;;;;;WAKrB,iBAAiB;;;UAIX;;WAEN;;WAEA,OAAO;;WAEP;;WAEA;;WAEA;WACA;;;UAkBM;WACN;;EAET,aAAa;aAAmB;;aAA+B;;EAC/D,MAAM,OAAO,aAAa,QAAQ;;;UAInB;WACN;WACA,QAAQ;;;;;;;;;;;wBAYH,UACd,gBACA,mBAAmB,eACnB,kBAAkB,iBACjB;;UCpHc;;WAEN;;WAEA;;WAEA;;WAEA;WACA;;;;;;WAMA;aACE;aACA;;;;;;;wBAQG,mBAAmB,SAAS,UAAU,SAAS;;;;;;;;wBA0D/C,oBACd,SAAS,aACT,SAAS,KAAK;;;;;wBC/EA,WAAW,SAAS,iBAAiB,iBAAgB;;wBAarD,YAAY,gBAAgB;;wBA6G5B,YAAY,KAAK,WAAW;;;;;wBAkC5B,WAAW,SAAS"}
package/dist/index.mjs CHANGED
@@ -1,6 +1,9 @@
1
- import { D as checkInvariants, E as checkInvariant, T as validateScenario, a as explore, o as replay, s as restrictSpec, t as observeCore } from "./src-D_hHC_-3.mjs";
2
- import { a as renderText, f as checkedRung, i as renderSpecs, l as specLadder, o as renderTrace, s as emitRegressionTest, t as renderJson, u as testedRung, y as describeVerdict } from "./src-fxWc6oGc.mjs";
3
- import { t as aggregate } from "./provers-DS44OeEm.mjs";
1
+ import "./src-BtLZPRyG.mjs";
2
+ import { D as checkInvariant, E as validateScenario, O as checkInvariants, a as restrictSpec, i as runPinned, n as explore, r as replay, t as observeCore } from "./src-Dx4QvrQb.mjs";
3
+ import { t as describeVerdict } from "./verdict-evEM5Gxx.mjs";
4
+ import { a as checkedRung, n as specLadder, r as testedRung } from "./src-DwYD3QQJ.mjs";
5
+ import { t as aggregate } from "./provers-D8VaY_OM.mjs";
6
+ import { a as renderText, c as emitUnsupportedTest, i as renderSpecs, o as renderTrace, s as emitRegressionTest, t as renderJson } from "./src-COuquJvI.mjs";
4
7
  // packages/core/src/spec-verdict.ts
5
8
  /** One line per spec verdict, for error messages; full rendering lives in `report`. */
6
9
  function describeSpecVerdict(v) {
@@ -17,6 +20,6 @@ function describeSpecVerdict(v) {
17
20
  case "UNKNOWN": return `UNKNOWN ${what}: ${v.cause}: ${v.reason}`;
18
21
  }
19
22
  }
20
- export { aggregate, checkInvariant, checkInvariants, checkedRung, describeSpecVerdict, describeVerdict, emitRegressionTest, explore, observeCore, renderJson, renderSpecs, renderText, renderTrace, replay, restrictSpec, specLadder, testedRung, validateScenario };
23
+ export { aggregate, checkInvariant, checkInvariants, checkedRung, describeSpecVerdict, describeVerdict, emitRegressionTest, emitUnsupportedTest, explore, observeCore, renderJson, renderSpecs, renderText, renderTrace, replay, restrictSpec, runPinned, specLadder, testedRung, validateScenario };
21
24
 
22
25
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../core/src/spec-verdict.ts"],"sourcesContent":["/**\n * Spec verdicts: what is known about one property of one pure function.\n * Kept apart from scenario verdicts in every report. The ladder runs\n * `CHECKED` (held on every input the simulator passed), then `TESTED` (held\n * on inputs generated from the binders' domains), then `PROVEN` (an engine\n * proved it for every input); `CONFLICT` when engines disagree.\n */\n\ninterface SpecVerdictBase {\n /** The module, as the scenario names it. */\n readonly module: string;\n readonly function: string;\n /** The property's export name in the spec file. */\n readonly property: string;\n /** The property as written. */\n readonly text: string;\n readonly assumptions: readonly string[];\n}\n\n/** The property held on every distinct input the simulator passed the function during the scenario's runs. */\nexport interface Checked extends SpecVerdictBase {\n readonly kind: \"CHECKED\";\n /** Distinct inputs the property was evaluated on. */\n readonly inputs: number;\n /** Distinct inputs outside the claim: a precondition failed, or a value fell outside its binder's domain. */\n readonly discarded: number;\n}\n\n/** The property held on inputs generated from its binders' domains, and on the simulator's where it passed any. */\nexport interface Tested extends SpecVerdictBase {\n readonly kind: \"TESTED\";\n /** Generated assignments the property held on. */\n readonly inputs: number;\n /** Generated assignments outside the claim: a precondition failed. */\n readonly discarded: number;\n /** The seed the assignments were drawn from; the same seed draws the same assignments. */\n readonly seed: string;\n /** Distinct inputs the simulator passed that the property also held on, when it passed any. */\n readonly checked?: number;\n}\n\n/** One assignment that breaks the property, as JavaScript literals, and where it came from. */\nexport interface Counterexample {\n /** In the property's binder order. */\n readonly binders: readonly { readonly name: string; readonly value: string }[];\n /** The simulator's call the assignment was taken from; absent when it was generated. */\n readonly call?: string;\n /** Set when evaluating the property threw instead of returning false. */\n readonly error?: string;\n}\n\n/** A counterexample breaks the property, found by the simulator's inputs, generated ones, or an engine. */\nexport interface Refuted extends SpecVerdictBase {\n readonly kind: \"REFUTED\";\n /** The rung that found the counterexample: a rung of the simulator, or an engine by name. */\n readonly rung: \"CHECKED\" | \"TESTED\" | \"PROVEN\";\n /** The engine, when the rung is PROVEN. */\n readonly engine?: { readonly name: string; readonly version: string };\n readonly counterexample: Counterexample;\n}\n\n/** Proved for every input by a named engine; the lower rungs' evidence is kept beside it. */\nexport interface Proven extends SpecVerdictBase {\n readonly kind: \"PROVEN\";\n readonly engine: { readonly name: string; readonly version: string };\n /** Generated inputs the TESTED rung held on, when it ran. */\n readonly tested?: number;\n /** Distinct inputs the simulator passed that the CHECKED rung held on, when it passed any. */\n readonly checked?: number;\n}\n\n/** Two engines disagree: one proves, one refutes. Never resolved automatically. */\nexport interface Conflict extends SpecVerdictBase {\n readonly kind: \"CONFLICT\";\n readonly proven: { readonly name: string; readonly version: string };\n readonly refuted: {\n readonly name: string;\n readonly version: string;\n readonly counterexample?: Counterexample;\n };\n}\n\nexport type SpecUnknownCause = \"gave_up\" | \"unsupported\" | \"unavailable\";\n\n/** Nothing is known about the property: the engine gave up, the construct is not supported, or no engine was available. */\nexport interface SpecUnknown extends SpecVerdictBase {\n readonly kind: \"UNKNOWN\";\n readonly cause: SpecUnknownCause;\n readonly reason: string;\n}\n\n/** What is known about one property of one pure function, from the highest rung that reached it. */\nexport type SpecVerdict = Checked | Tested | Proven | Refuted | Conflict | SpecUnknown;\n\n/** One line per spec verdict, for error messages; full rendering lives in `report`. */\nexport function describeSpecVerdict(v: SpecVerdict): string {\n const what = `${v.function} ${v.property}`;\n switch (v.kind) {\n case \"CHECKED\":\n return `CHECKED ${what}: held on ${v.inputs} input(s) the simulator passed`;\n case \"TESTED\":\n return `TESTED ${what}: held on ${v.inputs} generated input(s)`;\n case \"PROVEN\":\n return `PROVEN ${what}: by ${v.engine.name} ${v.engine.version}`;\n case \"CONFLICT\":\n return `CONFLICT ${what}: ${v.proven.name} proves it, ${v.refuted.name} refutes it`;\n case \"REFUTED\": {\n const c = v.counterexample;\n const where = c.call ?? c.binders.map((b) => `${b.name} = ${b.value}`).join(\", \");\n return `REFUTED ${what}: ${where}${c.error ? ` threw ${c.error}` : \"\"}`;\n }\n case \"UNKNOWN\":\n return `UNKNOWN ${what}: ${v.cause}: ${v.reason}`;\n }\n}\n"],"mappings":";;;;;AA+FA,SAAgB,oBAAoB,GAAwB;CAC1D,MAAM,OAAO,GAAG,EAAE,SAAS,GAAG,EAAE;CAChC,QAAQ,EAAE,MAAV;EACE,KAAK,WACH,OAAO,WAAW,KAAK,YAAY,EAAE,OAAO;EAC9C,KAAK,UACH,OAAO,UAAU,KAAK,YAAY,EAAE,OAAO;EAC7C,KAAK,UACH,OAAO,UAAU,KAAK,OAAO,EAAE,OAAO,KAAK,GAAG,EAAE,OAAO;EACzD,KAAK,YACH,OAAO,YAAY,KAAK,IAAI,EAAE,OAAO,KAAK,cAAc,EAAE,QAAQ,KAAK;EACzE,KAAK,WAAW;GACd,MAAM,IAAI,EAAE;GAEZ,OAAO,WAAW,KAAK,IADT,EAAE,QAAQ,EAAE,QAAQ,KAAK,MAAM,GAAG,EAAE,KAAK,KAAK,EAAE,OAAO,CAAC,CAAC,KAAK,IAAI,IAC7C,EAAE,QAAQ,UAAU,EAAE,UAAU;EACrE;EACA,KAAK,WACH,OAAO,WAAW,KAAK,IAAI,EAAE,MAAM,IAAI,EAAE;CAC7C;AACF"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../core/src/spec-verdict.ts"],"sourcesContent":["/**\n * Spec verdicts: what is known about one property of one pure function.\n * Kept apart from scenario verdicts in every report. The ladder runs\n * `CHECKED` (held on every input the simulator passed), then `TESTED` (held\n * on inputs generated from the binders' domains), then `PROVEN` (an engine\n * proved it for every input); `CONFLICT` when engines disagree.\n */\n\ninterface SpecVerdictBase {\n /** The module, as the scenario names it. */\n readonly module: string;\n readonly function: string;\n /** The property's export name in the spec file. */\n readonly property: string;\n /** The property as written. */\n readonly text: string;\n readonly assumptions: readonly string[];\n}\n\n/** The property held on every distinct input the simulator passed the function during the scenario's runs. */\nexport interface Checked extends SpecVerdictBase {\n readonly kind: \"CHECKED\";\n /** Distinct inputs the property was evaluated on. */\n readonly inputs: number;\n /** Distinct inputs outside the claim: a precondition failed, or a value fell outside its binder's domain. */\n readonly discarded: number;\n}\n\n/** The property held on inputs generated from its binders' domains, and on the simulator's where it passed any. */\nexport interface Tested extends SpecVerdictBase {\n readonly kind: \"TESTED\";\n /** Generated assignments the property held on. */\n readonly inputs: number;\n /** Generated assignments outside the claim: a precondition failed. */\n readonly discarded: number;\n /** The seed the assignments were drawn from; the same seed draws the same assignments. */\n readonly seed: string;\n /** Distinct inputs the simulator passed that the property also held on, when it passed any. */\n readonly checked?: number;\n}\n\n/** One assignment that breaks the property, as JavaScript literals, and where it came from. */\nexport interface Counterexample {\n /** In the property's binder order. */\n readonly binders: readonly { readonly name: string; readonly value: string }[];\n /** The simulator's call the assignment was taken from; absent when it was generated. */\n readonly call?: string;\n /** Set when evaluating the property threw instead of returning false. */\n readonly error?: string;\n}\n\n/** A counterexample breaks the property, found by the simulator's inputs, generated ones, or an engine. */\nexport interface Refuted extends SpecVerdictBase {\n readonly kind: \"REFUTED\";\n /** The rung that found the counterexample: a rung of the simulator, or an engine by name. */\n readonly rung: \"CHECKED\" | \"TESTED\" | \"PROVEN\";\n /** The engine, when the rung is PROVEN. */\n readonly engine?: { readonly name: string; readonly version: string };\n readonly counterexample: Counterexample;\n}\n\n/** Proved for every input by a named engine; the lower rungs' evidence is kept beside it. */\nexport interface Proven extends SpecVerdictBase {\n readonly kind: \"PROVEN\";\n readonly engine: { readonly name: string; readonly version: string };\n /** Generated inputs the TESTED rung held on, when it ran. */\n readonly tested?: number;\n /** Distinct inputs the simulator passed that the CHECKED rung held on, when it passed any. */\n readonly checked?: number;\n}\n\n/** Two engines disagree: one proves, one refutes. Never resolved automatically. */\nexport interface Conflict extends SpecVerdictBase {\n readonly kind: \"CONFLICT\";\n readonly proven: { readonly name: string; readonly version: string };\n readonly refuted: {\n readonly name: string;\n readonly version: string;\n readonly counterexample?: Counterexample;\n };\n}\n\nexport type SpecUnknownCause = \"gave_up\" | \"unsupported\" | \"unavailable\";\n\n/** Nothing is known about the property: the engine gave up, the construct is not supported, or no engine was available. */\nexport interface SpecUnknown extends SpecVerdictBase {\n readonly kind: \"UNKNOWN\";\n readonly cause: SpecUnknownCause;\n readonly reason: string;\n}\n\n/** What is known about one property of one pure function, from the highest rung that reached it. */\nexport type SpecVerdict = Checked | Tested | Proven | Refuted | Conflict | SpecUnknown;\n\n/** One line per spec verdict, for error messages; full rendering lives in `report`. */\nexport function describeSpecVerdict(v: SpecVerdict): string {\n const what = `${v.function} ${v.property}`;\n switch (v.kind) {\n case \"CHECKED\":\n return `CHECKED ${what}: held on ${v.inputs} input(s) the simulator passed`;\n case \"TESTED\":\n return `TESTED ${what}: held on ${v.inputs} generated input(s)`;\n case \"PROVEN\":\n return `PROVEN ${what}: by ${v.engine.name} ${v.engine.version}`;\n case \"CONFLICT\":\n return `CONFLICT ${what}: ${v.proven.name} proves it, ${v.refuted.name} refutes it`;\n case \"REFUTED\": {\n const c = v.counterexample;\n const where = c.call ?? c.binders.map((b) => `${b.name} = ${b.value}`).join(\", \");\n return `REFUTED ${what}: ${where}${c.error ? ` threw ${c.error}` : \"\"}`;\n }\n case \"UNKNOWN\":\n return `UNKNOWN ${what}: ${v.cause}: ${v.reason}`;\n }\n}\n"],"mappings":";;;;;;;;AA+FA,SAAgB,oBAAoB,GAAwB;CAC1D,MAAM,OAAO,GAAG,EAAE,SAAS,GAAG,EAAE;CAChC,QAAQ,EAAE,MAAV;EACE,KAAK,WACH,OAAO,WAAW,KAAK,YAAY,EAAE,OAAO;EAC9C,KAAK,UACH,OAAO,UAAU,KAAK,YAAY,EAAE,OAAO;EAC7C,KAAK,UACH,OAAO,UAAU,KAAK,OAAO,EAAE,OAAO,KAAK,GAAG,EAAE,OAAO;EACzD,KAAK,YACH,OAAO,YAAY,KAAK,IAAI,EAAE,OAAO,KAAK,cAAc,EAAE,QAAQ,KAAK;EACzE,KAAK,WAAW;GACd,MAAM,IAAI,EAAE;GAEZ,OAAO,WAAW,KAAK,IADT,EAAE,QAAQ,EAAE,QAAQ,KAAK,MAAM,GAAG,EAAE,KAAK,KAAK,EAAE,OAAO,CAAC,CAAC,KAAK,IAAI,IAC7C,EAAE,QAAQ,UAAU,EAAE,UAAU;EACrE;EACA,KAAK,WACH,OAAO,WAAW,KAAK,IAAI,EAAE,MAAM,IAAI,EAAE;CAC7C;AACF"}