tslaws 1.1.0 → 1.3.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.
@@ -65,16 +65,29 @@ interface FileIndex {
65
65
  imports: Map<string, string>;
66
66
  /** Module-level `const NAME = ...` and `exports.NAME = ...` initializers, evaluated on demand. */
67
67
  constants: Map<string, ts.Expression>;
68
+ /** Re-exported bindings (`Object.defineProperty(exports, "X", { get: () => mod_1.Y })` or `exports.X = mod_1.Y`). */
69
+ reexports: Map<string, {
70
+ file: string;
71
+ name: string;
72
+ }>;
73
+ /** Star re-exports (`__exportStar(require("./sub"), exports)`). */
74
+ stars: string[];
68
75
  }
76
+ /** Resolves a relative CommonJS specifier the way Node does: `base.js`, else `base/index.js`. */
77
+ export declare function resolveRelativeJs(fromFile: string, specifier: string): string;
78
+ /** Reads and parses a compiled `.js` file, reusing the AST while its size and modification time are unchanged. */
79
+ export declare function readParsedJs(file: string): ts.SourceFile;
69
80
  declare class Frame {
70
81
  env: Map<string, Value>;
71
82
  done: string;
72
83
  brk: string;
73
84
  cnt: string;
74
85
  ret: Value | undefined;
86
+ fnKey: string | undefined;
87
+ decreases: Int | Big | undefined;
75
88
  readonly file: string;
76
89
  readonly depth: number;
77
- constructor(file: string, depth: number);
90
+ constructor(file: string, depth: number, fnKey?: string);
78
91
  fork(): Frame;
79
92
  }
80
93
  export declare const bool: (t: string) => Bool;
@@ -93,6 +106,17 @@ export declare class Executor {
93
106
  private havocked;
94
107
  readonly assumptions: string[];
95
108
  readonly obligations: string[];
109
+ /** Intermediate proof steps from `lemma(...)` / `calc(...)` / `induct(...)`: each is proved under prior assumptions. */
110
+ readonly subgoals: {
111
+ assumptions: string[];
112
+ goal: string;
113
+ }[];
114
+ /** Assumptions introduced by `lemma(...)` / `calc(...)` (omitted when sending the whole query to an independent certifier). */
115
+ readonly lemmaAssumptions: Set<string>;
116
+ /** True when `induct()` discharged the claim via base + inductive step subgoals. */
117
+ usedInduction: boolean;
118
+ /** Active call frames for checking recursive `decreases(...)` termination measures. */
119
+ private readonly callFrames;
96
120
  readonly bounded: string[];
97
121
  /** Advice for the reader when a proof fails on an obligation (a divisor that may be 0). */
98
122
  readonly hints: string[];
@@ -116,7 +140,7 @@ export declare class Executor {
116
140
  readonly bound: number;
117
141
  constructor(bound: number);
118
142
  index(file: string): FileIndex;
119
- /** `exports.NAME = value` assigned exactly once, at the top level, is a constant; any other assignment spoils it. */
143
+ /** `exports.NAME = value` assigned exactly once, at the top level, is a constant; also records CommonJS re-exports. */
120
144
  private indexExports;
121
145
  private readonly constantValues;
122
146
  private readonly resolving;
@@ -151,7 +175,7 @@ export declare class Executor {
151
175
  private branch;
152
176
  private forStatement;
153
177
  private loop;
154
- /** The `invariant(...)` calls leading a loop body, and the statements after them. */
178
+ /** The `invariant(...)` and `decreases(...)` calls leading a loop body, and the statements after them. */
155
179
  private invariantsOf;
156
180
  private calleeOf;
157
181
  /** The names a piece of code assigns, increments or mutates. */
@@ -246,6 +270,17 @@ export declare class Executor {
246
270
  /** `forall(xs, p)` / `exists(xs, p)` over the slots of the array model, so a claim about them is bounded like the array. */
247
271
  private quantifier;
248
272
  private assumeCall;
273
+ private lemmaCall;
274
+ private requiresCall;
275
+ private impliesCall;
276
+ private iffCall;
277
+ private distinctCall;
278
+ private unreachableCall;
279
+ private calcCall;
280
+ private inductCall;
281
+ private ensuresCall;
282
+ private decreasesCall;
283
+ private resolveFunction;
249
284
  private callProject;
250
285
  private math;
251
286
  private mathRaw;