proofery 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/LICENSE +21 -0
- package/README.md +247 -0
- package/dist/block.d.ts +19 -0
- package/dist/block.d.ts.map +1 -0
- package/dist/block.js +24 -0
- package/dist/block.js.map +1 -0
- package/dist/calculateVerifier.d.ts +10 -0
- package/dist/calculateVerifier.d.ts.map +1 -0
- package/dist/calculateVerifier.js +184 -0
- package/dist/calculateVerifier.js.map +1 -0
- package/dist/cli.d.ts +6 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +94 -0
- package/dist/cli.js.map +1 -0
- package/dist/context.d.ts +33 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +50 -0
- package/dist/context.js.map +1 -0
- package/dist/errors.d.ts +10 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +16 -0
- package/dist/errors.js.map +1 -0
- package/dist/expression.d.ts +32 -0
- package/dist/expression.d.ts.map +1 -0
- package/dist/expression.js +123 -0
- package/dist/expression.js.map +1 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +32 -0
- package/dist/index.js.map +1 -0
- package/dist/nodeParser.d.ts +16 -0
- package/dist/nodeParser.d.ts.map +1 -0
- package/dist/nodeParser.js +23 -0
- package/dist/nodeParser.js.map +1 -0
- package/dist/parser.d.ts +10 -0
- package/dist/parser.d.ts.map +1 -0
- package/dist/parser.js +161 -0
- package/dist/parser.js.map +1 -0
- package/dist/simplifier.d.ts +10 -0
- package/dist/simplifier.d.ts.map +1 -0
- package/dist/simplifier.js +52 -0
- package/dist/simplifier.js.map +1 -0
- package/dist/verifier.d.ts +9 -0
- package/dist/verifier.d.ts.map +1 -0
- package/dist/verifier.js +547 -0
- package/dist/verifier.js.map +1 -0
- package/package.json +48 -0
package/dist/verifier.js
ADDED
|
@@ -0,0 +1,547 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Proof verification logic.
|
|
3
|
+
*/
|
|
4
|
+
import { Expression } from './expression.js';
|
|
5
|
+
import { Context } from './context.js';
|
|
6
|
+
import { VerificationError } from './errors.js';
|
|
7
|
+
import { simplify } from './simplifier.js';
|
|
8
|
+
import { verifyCalculate } from './calculateVerifier.js';
|
|
9
|
+
/**
|
|
10
|
+
* Verify all axioms and theorems in a file.
|
|
11
|
+
*/
|
|
12
|
+
export function verifyFile(blocks, verbose = false) {
|
|
13
|
+
// First pass: collect all axioms and theorems
|
|
14
|
+
const axiomsAndTheorems = new Map();
|
|
15
|
+
for (const block of blocks) {
|
|
16
|
+
if (block.blockType === 'axiom' || block.blockType === 'theorem') {
|
|
17
|
+
if (block.args.length !== 1) {
|
|
18
|
+
throw new VerificationError(`Line ${block.lineNum}: ${block.blockType} must have exactly one argument (the name)`);
|
|
19
|
+
}
|
|
20
|
+
const name = block.args[0].name;
|
|
21
|
+
if (block.args[0].children.length > 0) {
|
|
22
|
+
throw new VerificationError(`Line ${block.lineNum}: ${block.blockType} name must be a simple identifier`);
|
|
23
|
+
}
|
|
24
|
+
axiomsAndTheorems.set(name, block);
|
|
25
|
+
if (verbose) {
|
|
26
|
+
console.log(`Found ${block.blockType}: ${name}`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
throw new VerificationError(`Line ${block.lineNum}: Top-level blocks must be 'axiom' or 'theorem', got '${block.blockType}'`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
// Second pass: verify theorems
|
|
34
|
+
for (const block of blocks) {
|
|
35
|
+
if (block.blockType === 'theorem') {
|
|
36
|
+
const name = block.args[0].name;
|
|
37
|
+
if (verbose) {
|
|
38
|
+
console.log(`\nVerifying theorem: ${name}`);
|
|
39
|
+
}
|
|
40
|
+
verifyTheorem(block, axiomsAndTheorems, verbose);
|
|
41
|
+
if (verbose) {
|
|
42
|
+
console.log(`✓ Theorem ${name} verified`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Verify a single theorem.
|
|
49
|
+
*/
|
|
50
|
+
function verifyTheorem(theoremBlock, axiomsAndTheorems, verbose) {
|
|
51
|
+
// Create initial context from suppose blocks
|
|
52
|
+
const context = new Context();
|
|
53
|
+
const supposeBlocks = [];
|
|
54
|
+
let concludeBlock = null;
|
|
55
|
+
let proofBlock = null;
|
|
56
|
+
// Parse structure: suppose* conclude proof
|
|
57
|
+
for (const child of theoremBlock.children) {
|
|
58
|
+
if (child.blockType === 'suppose') {
|
|
59
|
+
supposeBlocks.push(child);
|
|
60
|
+
}
|
|
61
|
+
else if (child.blockType === 'conclude') {
|
|
62
|
+
if (concludeBlock !== null) {
|
|
63
|
+
throw new VerificationError(`Line ${child.lineNum}: Multiple 'conclude' blocks in theorem`);
|
|
64
|
+
}
|
|
65
|
+
concludeBlock = child;
|
|
66
|
+
}
|
|
67
|
+
else if (child.blockType === 'proof') {
|
|
68
|
+
if (proofBlock !== null) {
|
|
69
|
+
throw new VerificationError(`Line ${child.lineNum}: Multiple 'proof' blocks in theorem`);
|
|
70
|
+
}
|
|
71
|
+
proofBlock = child;
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
throw new VerificationError(`Line ${child.lineNum}: Invalid block type '${child.blockType}' in theorem`);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
if (concludeBlock === null) {
|
|
78
|
+
throw new VerificationError(`Line ${theoremBlock.lineNum}: Theorem missing 'conclude' block`);
|
|
79
|
+
}
|
|
80
|
+
if (proofBlock === null) {
|
|
81
|
+
throw new VerificationError(`Line ${theoremBlock.lineNum}: Theorem missing 'proof' block`);
|
|
82
|
+
}
|
|
83
|
+
// Process suppose blocks
|
|
84
|
+
for (const suppose of supposeBlocks) {
|
|
85
|
+
processSuppose(suppose, context);
|
|
86
|
+
}
|
|
87
|
+
// Process conclude block
|
|
88
|
+
processConclude(concludeBlock, context);
|
|
89
|
+
// Verify the proof
|
|
90
|
+
const goalResolved = verifyProof(proofBlock, context, axiomsAndTheorems, verbose);
|
|
91
|
+
if (!goalResolved) {
|
|
92
|
+
throw new VerificationError(`Line ${proofBlock.lineNum}: Proof does not resolve the goal`);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Process a suppose block: suppose name : type
|
|
97
|
+
*/
|
|
98
|
+
function processSuppose(supposeBlock, context) {
|
|
99
|
+
if (supposeBlock.args.length !== 1) {
|
|
100
|
+
throw new VerificationError(`Line ${supposeBlock.lineNum}: 'suppose' must have exactly one argument`);
|
|
101
|
+
}
|
|
102
|
+
const arg = supposeBlock.args[0];
|
|
103
|
+
if (arg.name !== 'var' || arg.children.length !== 2) {
|
|
104
|
+
throw new VerificationError(`Line ${supposeBlock.lineNum}: 'suppose' argument must be of form 'name : type'`);
|
|
105
|
+
}
|
|
106
|
+
const varName = arg.children[0].name;
|
|
107
|
+
const varType = arg.children[1];
|
|
108
|
+
if (arg.children[0].children.length > 0) {
|
|
109
|
+
throw new VerificationError(`Line ${supposeBlock.lineNum}: Variable name must be a simple identifier`);
|
|
110
|
+
}
|
|
111
|
+
context.addVariable(varName, varType);
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Process a conclude block: conclude type
|
|
115
|
+
*/
|
|
116
|
+
function processConclude(concludeBlock, context) {
|
|
117
|
+
if (concludeBlock.args.length !== 1) {
|
|
118
|
+
throw new VerificationError(`Line ${concludeBlock.lineNum}: 'conclude' must have exactly one argument`);
|
|
119
|
+
}
|
|
120
|
+
context.goal = concludeBlock.args[0];
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Verify a proof block and return whether the goal was resolved.
|
|
124
|
+
*/
|
|
125
|
+
function verifyProof(proofBlock, context, axiomsAndTheorems, verbose) {
|
|
126
|
+
let goalResolved = false;
|
|
127
|
+
for (const child of proofBlock.children) {
|
|
128
|
+
const result = verifyProofStep(child, context, axiomsAndTheorems, verbose);
|
|
129
|
+
if (result) {
|
|
130
|
+
goalResolved = true;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return goalResolved;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Verify a single proof step. Returns true if the goal was resolved.
|
|
137
|
+
*/
|
|
138
|
+
function verifyProofStep(step, context, axiomsAndTheorems, verbose) {
|
|
139
|
+
switch (step.blockType) {
|
|
140
|
+
case 'unpack-and':
|
|
141
|
+
return verifyUnpackAnd(step, context, axiomsAndTheorems, verbose);
|
|
142
|
+
case 'cases':
|
|
143
|
+
return verifyCases(step, context, axiomsAndTheorems, verbose);
|
|
144
|
+
case 'witness':
|
|
145
|
+
return verifyWitness(step, context);
|
|
146
|
+
case 'assert-goal':
|
|
147
|
+
return verifyAssertGoal(step, context);
|
|
148
|
+
case 'exact':
|
|
149
|
+
return verifyExact(step, context);
|
|
150
|
+
case 'calculate':
|
|
151
|
+
return verifyCalculate(step, context, axiomsAndTheorems);
|
|
152
|
+
case 'assert':
|
|
153
|
+
return verifyAssert(step, context);
|
|
154
|
+
case 'define':
|
|
155
|
+
return verifyDefine(step, context);
|
|
156
|
+
case 'consider':
|
|
157
|
+
return verifyConsider(step, context);
|
|
158
|
+
case 'forall-apply':
|
|
159
|
+
return verifyForallApply(step, context);
|
|
160
|
+
case 'deconstruct-exists':
|
|
161
|
+
return verifyDeconstructExists(step, context);
|
|
162
|
+
case 'we-have':
|
|
163
|
+
return verifyWeHave(step, context, axiomsAndTheorems, verbose);
|
|
164
|
+
case 'focus-or':
|
|
165
|
+
return verifyFocusOr(step, context);
|
|
166
|
+
default:
|
|
167
|
+
throw new VerificationError(`Line ${step.lineNum}: Unknown proof step type '${step.blockType}'`);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Verify unpack-and: goal must be and(a, b), requires two goal children.
|
|
172
|
+
*/
|
|
173
|
+
function verifyUnpackAnd(step, context, axiomsAndTheorems, verbose) {
|
|
174
|
+
if (step.args.length !== 0) {
|
|
175
|
+
throw new VerificationError(`Line ${step.lineNum}: 'unpack-and' takes no arguments`);
|
|
176
|
+
}
|
|
177
|
+
if (context.goal === null) {
|
|
178
|
+
throw new VerificationError(`Line ${step.lineNum}: No goal to unpack`);
|
|
179
|
+
}
|
|
180
|
+
if (context.goal.name !== 'and' || context.goal.children.length !== 2) {
|
|
181
|
+
throw new VerificationError(`Line ${step.lineNum}: Goal must be and(a, b), got ${context.goal}`);
|
|
182
|
+
}
|
|
183
|
+
if (step.children.length !== 2) {
|
|
184
|
+
throw new VerificationError(`Line ${step.lineNum}: 'unpack-and' requires exactly 2 children`);
|
|
185
|
+
}
|
|
186
|
+
// Verify both children are goal blocks
|
|
187
|
+
for (let i = 0; i < step.children.length; i++) {
|
|
188
|
+
const child = step.children[i];
|
|
189
|
+
if (child.blockType !== 'goal') {
|
|
190
|
+
throw new VerificationError(`Line ${child.lineNum}: 'unpack-and' children must be 'goal' blocks`);
|
|
191
|
+
}
|
|
192
|
+
if (child.args.length !== 1) {
|
|
193
|
+
throw new VerificationError(`Line ${child.lineNum}: 'goal' must have exactly one argument`);
|
|
194
|
+
}
|
|
195
|
+
const expectedGoal = context.goal.children[i];
|
|
196
|
+
if (!child.args[0].equals(expectedGoal)) {
|
|
197
|
+
throw new VerificationError(`Line ${child.lineNum}: Expected goal ${expectedGoal}, got ${child.args[0]}`);
|
|
198
|
+
}
|
|
199
|
+
// Each goal must have one proof child
|
|
200
|
+
if (child.children.length !== 1 || child.children[0].blockType !== 'proof') {
|
|
201
|
+
throw new VerificationError(`Line ${child.lineNum}: 'goal' must have exactly one 'proof' child`);
|
|
202
|
+
}
|
|
203
|
+
// Verify the proof with the subgoal
|
|
204
|
+
const subContext = context.copy();
|
|
205
|
+
subContext.goal = expectedGoal;
|
|
206
|
+
const resolved = verifyProof(child.children[0], subContext, axiomsAndTheorems, verbose);
|
|
207
|
+
if (!resolved) {
|
|
208
|
+
throw new VerificationError(`Line ${child.lineNum}: Proof does not resolve goal ${expectedGoal}`);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
return true; // Goal resolved
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Verify cases: variable must have type or(a, b), requires two case children.
|
|
215
|
+
*/
|
|
216
|
+
function verifyCases(step, context, axiomsAndTheorems, verbose) {
|
|
217
|
+
if (step.args.length !== 1) {
|
|
218
|
+
throw new VerificationError(`Line ${step.lineNum}: 'cases' takes exactly one argument (variable name)`);
|
|
219
|
+
}
|
|
220
|
+
const varName = step.args[0].name;
|
|
221
|
+
if (step.args[0].children.length > 0) {
|
|
222
|
+
throw new VerificationError(`Line ${step.lineNum}: 'cases' argument must be a simple variable name`);
|
|
223
|
+
}
|
|
224
|
+
if (!context.hasVariable(varName)) {
|
|
225
|
+
throw new VerificationError(`Line ${step.lineNum}: Variable '${varName}' not in context`);
|
|
226
|
+
}
|
|
227
|
+
const varType = context.getVariableType(varName);
|
|
228
|
+
if (varType.name !== 'or' || varType.children.length !== 2) {
|
|
229
|
+
throw new VerificationError(`Line ${step.lineNum}: Variable '${varName}' must have type or(a, b), got ${varType}`);
|
|
230
|
+
}
|
|
231
|
+
if (step.children.length !== 2) {
|
|
232
|
+
throw new VerificationError(`Line ${step.lineNum}: 'cases' requires exactly 2 'case' children`);
|
|
233
|
+
}
|
|
234
|
+
// Verify both case children
|
|
235
|
+
for (let i = 0; i < step.children.length; i++) {
|
|
236
|
+
const child = step.children[i];
|
|
237
|
+
if (child.blockType !== 'case') {
|
|
238
|
+
throw new VerificationError(`Line ${child.lineNum}: 'cases' children must be 'case' blocks`);
|
|
239
|
+
}
|
|
240
|
+
if (child.args.length !== 1) {
|
|
241
|
+
throw new VerificationError(`Line ${child.lineNum}: 'case' must have exactly one argument`);
|
|
242
|
+
}
|
|
243
|
+
const arg = child.args[0];
|
|
244
|
+
if (arg.name !== 'var' || arg.children.length !== 2) {
|
|
245
|
+
throw new VerificationError(`Line ${child.lineNum}: 'case' argument must be of form 'name : type'`);
|
|
246
|
+
}
|
|
247
|
+
const caseVarName = arg.children[0].name;
|
|
248
|
+
const caseType = arg.children[1];
|
|
249
|
+
const expectedType = varType.children[i];
|
|
250
|
+
if (!caseType.equals(expectedType)) {
|
|
251
|
+
throw new VerificationError(`Line ${child.lineNum}: Expected case type ${expectedType}, got ${caseType}`);
|
|
252
|
+
}
|
|
253
|
+
// Verify proof with added case variable
|
|
254
|
+
const caseContext = context.copy();
|
|
255
|
+
caseContext.addVariable(caseVarName, caseType);
|
|
256
|
+
// Each case needs a proof
|
|
257
|
+
if (child.children.length !== 1 || child.children[0].blockType !== 'proof') {
|
|
258
|
+
throw new VerificationError(`Line ${child.lineNum}: 'case' must have exactly one 'proof' child`);
|
|
259
|
+
}
|
|
260
|
+
const resolved = verifyProof(child.children[0], caseContext, axiomsAndTheorems, verbose);
|
|
261
|
+
if (!resolved) {
|
|
262
|
+
throw new VerificationError(`Line ${child.lineNum}: Proof in case does not resolve goal`);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
return true; // Goal resolved
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Verify witness: goal must be exists(var(name, type), body), modifies goal.
|
|
269
|
+
*/
|
|
270
|
+
function verifyWitness(step, context) {
|
|
271
|
+
if (step.args.length !== 1) {
|
|
272
|
+
throw new VerificationError(`Line ${step.lineNum}: 'witness' takes exactly one argument`);
|
|
273
|
+
}
|
|
274
|
+
const witnessName = step.args[0].name;
|
|
275
|
+
if (step.args[0].children.length > 0) {
|
|
276
|
+
throw new VerificationError(`Line ${step.lineNum}: 'witness' argument must be a simple identifier`);
|
|
277
|
+
}
|
|
278
|
+
if (context.goal === null) {
|
|
279
|
+
throw new VerificationError(`Line ${step.lineNum}: No goal for witness`);
|
|
280
|
+
}
|
|
281
|
+
if (context.goal.name !== 'exists' || context.goal.children.length !== 2) {
|
|
282
|
+
throw new VerificationError(`Line ${step.lineNum}: Goal must be exists(var(name, type), body), got ${context.goal}`);
|
|
283
|
+
}
|
|
284
|
+
const varExpr = context.goal.children[0];
|
|
285
|
+
if (varExpr.name !== 'var' || varExpr.children.length !== 2) {
|
|
286
|
+
throw new VerificationError(`Line ${step.lineNum}: exists must have var(name, type) as first argument`);
|
|
287
|
+
}
|
|
288
|
+
const boundVarName = varExpr.children[0].name;
|
|
289
|
+
const body = context.goal.children[1];
|
|
290
|
+
// Substitute witness into body
|
|
291
|
+
context.goal = body.substitute(boundVarName, new Expression(witnessName));
|
|
292
|
+
return false; // Does not resolve goal
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Verify assert-goal: expression must match current goal.
|
|
296
|
+
*/
|
|
297
|
+
function verifyAssertGoal(step, context) {
|
|
298
|
+
if (step.args.length !== 1) {
|
|
299
|
+
throw new VerificationError(`Line ${step.lineNum}: 'assert-goal' takes exactly one argument`);
|
|
300
|
+
}
|
|
301
|
+
const expectedGoal = step.args[0];
|
|
302
|
+
if (context.goal === null) {
|
|
303
|
+
throw new VerificationError(`Line ${step.lineNum}: No current goal`);
|
|
304
|
+
}
|
|
305
|
+
if (!context.goal.equals(expectedGoal)) {
|
|
306
|
+
throw new VerificationError(`Line ${step.lineNum}: Expected goal ${expectedGoal}, but current goal is ${context.goal}`);
|
|
307
|
+
}
|
|
308
|
+
return false; // Does not resolve goal
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Verify exact: two variants - variable name or expression after simplification.
|
|
312
|
+
*/
|
|
313
|
+
function verifyExact(step, context) {
|
|
314
|
+
if (step.args.length !== 1) {
|
|
315
|
+
throw new VerificationError(`Line ${step.lineNum}: 'exact' takes exactly one argument`);
|
|
316
|
+
}
|
|
317
|
+
const arg = step.args[0];
|
|
318
|
+
if (context.goal === null) {
|
|
319
|
+
throw new VerificationError(`Line ${step.lineNum}: No goal to resolve`);
|
|
320
|
+
}
|
|
321
|
+
// Variant 1: Simple variable name
|
|
322
|
+
if (arg.children.length === 0 && context.hasVariable(arg.name)) {
|
|
323
|
+
const varType = context.getVariableType(arg.name);
|
|
324
|
+
if (!varType.equals(context.goal)) {
|
|
325
|
+
throw new VerificationError(`Line ${step.lineNum}: Variable '${arg.name}' has type ${varType}, but goal is ${context.goal}`);
|
|
326
|
+
}
|
|
327
|
+
return true; // Goal resolved
|
|
328
|
+
}
|
|
329
|
+
// Variant 2: Expression after simplification
|
|
330
|
+
const simplified = simplify(arg, context);
|
|
331
|
+
if (!simplified.equals(context.goal)) {
|
|
332
|
+
throw new VerificationError(`Line ${step.lineNum}: Expression ${arg} simplifies to ${simplified}, but goal is ${context.goal}`);
|
|
333
|
+
}
|
|
334
|
+
return true; // Goal resolved
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Verify assert: assert name : type.
|
|
338
|
+
*/
|
|
339
|
+
function verifyAssert(step, context) {
|
|
340
|
+
if (step.args.length !== 1) {
|
|
341
|
+
throw new VerificationError(`Line ${step.lineNum}: 'assert' must have exactly one argument`);
|
|
342
|
+
}
|
|
343
|
+
const arg = step.args[0];
|
|
344
|
+
if (arg.name !== 'var' || arg.children.length !== 2) {
|
|
345
|
+
throw new VerificationError(`Line ${step.lineNum}: 'assert' argument must be of form 'name : type'`);
|
|
346
|
+
}
|
|
347
|
+
const varName = arg.children[0].name;
|
|
348
|
+
const expectedType = arg.children[1];
|
|
349
|
+
if (!context.hasVariable(varName)) {
|
|
350
|
+
throw new VerificationError(`Line ${step.lineNum}: Variable '${varName}' not in context`);
|
|
351
|
+
}
|
|
352
|
+
const actualType = context.getVariableType(varName);
|
|
353
|
+
if (!actualType.equals(expectedType)) {
|
|
354
|
+
throw new VerificationError(`Line ${step.lineNum}: Variable '${varName}' has type ${actualType}, expected ${expectedType}`);
|
|
355
|
+
}
|
|
356
|
+
return false; // Does not resolve goal
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Verify define: define name : eq(lhs, rhs).
|
|
360
|
+
*/
|
|
361
|
+
function verifyDefine(step, context) {
|
|
362
|
+
if (step.args.length !== 1) {
|
|
363
|
+
throw new VerificationError(`Line ${step.lineNum}: 'define' must have exactly one argument`);
|
|
364
|
+
}
|
|
365
|
+
const arg = step.args[0];
|
|
366
|
+
if (arg.name !== 'var' || arg.children.length !== 2) {
|
|
367
|
+
throw new VerificationError(`Line ${step.lineNum}: 'define' argument must be of form 'name : type'`);
|
|
368
|
+
}
|
|
369
|
+
const varName = arg.children[0].name;
|
|
370
|
+
const varType = arg.children[1];
|
|
371
|
+
if (context.hasVariable(varName)) {
|
|
372
|
+
throw new VerificationError(`Line ${step.lineNum}: Variable '${varName}' already in context`);
|
|
373
|
+
}
|
|
374
|
+
// Check that type is an eq expression
|
|
375
|
+
if (varType.name !== 'eq' || varType.children.length !== 2) {
|
|
376
|
+
throw new VerificationError(`Line ${step.lineNum}: 'define' type must be eq(lhs, rhs)`);
|
|
377
|
+
}
|
|
378
|
+
context.addVariable(varName, varType);
|
|
379
|
+
return false; // Does not resolve goal
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* Verify consider: goal must be forall(var(name, type), body).
|
|
383
|
+
*/
|
|
384
|
+
function verifyConsider(step, context) {
|
|
385
|
+
if (step.args.length !== 1) {
|
|
386
|
+
throw new VerificationError(`Line ${step.lineNum}: 'consider' takes exactly one argument`);
|
|
387
|
+
}
|
|
388
|
+
const varName = step.args[0].name;
|
|
389
|
+
if (step.args[0].children.length > 0) {
|
|
390
|
+
throw new VerificationError(`Line ${step.lineNum}: 'consider' argument must be a simple identifier`);
|
|
391
|
+
}
|
|
392
|
+
if (context.goal === null) {
|
|
393
|
+
throw new VerificationError(`Line ${step.lineNum}: No goal for consider`);
|
|
394
|
+
}
|
|
395
|
+
if (context.goal.name !== 'forall' || context.goal.children.length !== 2) {
|
|
396
|
+
throw new VerificationError(`Line ${step.lineNum}: Goal must be forall(var(name, type), body), got ${context.goal}`);
|
|
397
|
+
}
|
|
398
|
+
const varExpr = context.goal.children[0];
|
|
399
|
+
if (varExpr.name !== 'var' || varExpr.children.length !== 2) {
|
|
400
|
+
throw new VerificationError(`Line ${step.lineNum}: forall must have var(name, type) as first argument`);
|
|
401
|
+
}
|
|
402
|
+
const boundVarName = varExpr.children[0].name;
|
|
403
|
+
const varType = varExpr.children[1];
|
|
404
|
+
const body = context.goal.children[1];
|
|
405
|
+
if (boundVarName !== varName) {
|
|
406
|
+
throw new VerificationError(`Line ${step.lineNum}: Expected variable '${boundVarName}', got '${varName}'`);
|
|
407
|
+
}
|
|
408
|
+
context.addVariable(varName, varType);
|
|
409
|
+
context.goal = body;
|
|
410
|
+
return false; // Does not resolve goal
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* Verify forall-apply: apply forall to an argument.
|
|
414
|
+
*/
|
|
415
|
+
function verifyForallApply(step, context) {
|
|
416
|
+
if (step.args.length !== 3) {
|
|
417
|
+
throw new VerificationError(`Line ${step.lineNum}: 'forall-apply' takes exactly 3 arguments`);
|
|
418
|
+
}
|
|
419
|
+
const forallVar = step.args[0].name;
|
|
420
|
+
const argVar = step.args[1].name;
|
|
421
|
+
const resultVar = step.args[2].name;
|
|
422
|
+
if (step.args[0].children.length > 0 || step.args[1].children.length > 0 || step.args[2].children.length > 0) {
|
|
423
|
+
throw new VerificationError(`Line ${step.lineNum}: 'forall-apply' arguments must be simple identifiers`);
|
|
424
|
+
}
|
|
425
|
+
if (!context.hasVariable(forallVar)) {
|
|
426
|
+
throw new VerificationError(`Line ${step.lineNum}: Variable '${forallVar}' not in context`);
|
|
427
|
+
}
|
|
428
|
+
if (!context.hasVariable(argVar)) {
|
|
429
|
+
throw new VerificationError(`Line ${step.lineNum}: Variable '${argVar}' not in context`);
|
|
430
|
+
}
|
|
431
|
+
if (context.hasVariable(resultVar)) {
|
|
432
|
+
throw new VerificationError(`Line ${step.lineNum}: Variable '${resultVar}' already in context`);
|
|
433
|
+
}
|
|
434
|
+
const forallType = context.getVariableType(forallVar);
|
|
435
|
+
if (forallType.name !== 'forall' || forallType.children.length !== 2) {
|
|
436
|
+
throw new VerificationError(`Line ${step.lineNum}: Variable '${forallVar}' must have type forall(var(name, type), body)`);
|
|
437
|
+
}
|
|
438
|
+
const varExpr = forallType.children[0];
|
|
439
|
+
if (varExpr.name !== 'var' || varExpr.children.length !== 2) {
|
|
440
|
+
throw new VerificationError(`Line ${step.lineNum}: forall must have var(name, type) as first argument`);
|
|
441
|
+
}
|
|
442
|
+
const boundVarName = varExpr.children[0].name;
|
|
443
|
+
const expectedArgType = varExpr.children[1];
|
|
444
|
+
const body = forallType.children[1];
|
|
445
|
+
const argType = context.getVariableType(argVar);
|
|
446
|
+
if (!argType.equals(expectedArgType)) {
|
|
447
|
+
throw new VerificationError(`Line ${step.lineNum}: Argument '${argVar}' has type ${argType}, expected ${expectedArgType}`);
|
|
448
|
+
}
|
|
449
|
+
// Substitute argVar for boundVarName in body
|
|
450
|
+
const resultType = body.substitute(boundVarName, new Expression(argVar));
|
|
451
|
+
context.addVariable(resultVar, resultType);
|
|
452
|
+
return false; // Does not resolve goal
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* Verify deconstruct-exists: extract witness and hypothesis from exists.
|
|
456
|
+
*/
|
|
457
|
+
function verifyDeconstructExists(step, context) {
|
|
458
|
+
if (step.args.length !== 3) {
|
|
459
|
+
throw new VerificationError(`Line ${step.lineNum}: 'deconstruct-exists' takes exactly 3 arguments`);
|
|
460
|
+
}
|
|
461
|
+
const existsVar = step.args[0].name;
|
|
462
|
+
const witnessVar = step.args[1].name;
|
|
463
|
+
const hypVar = step.args[2].name;
|
|
464
|
+
if (step.args[0].children.length > 0 || step.args[1].children.length > 0 || step.args[2].children.length > 0) {
|
|
465
|
+
throw new VerificationError(`Line ${step.lineNum}: 'deconstruct-exists' arguments must be simple identifiers`);
|
|
466
|
+
}
|
|
467
|
+
if (!context.hasVariable(existsVar)) {
|
|
468
|
+
throw new VerificationError(`Line ${step.lineNum}: Variable '${existsVar}' not in context`);
|
|
469
|
+
}
|
|
470
|
+
if (context.hasVariable(witnessVar)) {
|
|
471
|
+
throw new VerificationError(`Line ${step.lineNum}: Variable '${witnessVar}' already in context`);
|
|
472
|
+
}
|
|
473
|
+
if (context.hasVariable(hypVar)) {
|
|
474
|
+
throw new VerificationError(`Line ${step.lineNum}: Variable '${hypVar}' already in context`);
|
|
475
|
+
}
|
|
476
|
+
const existsType = context.getVariableType(existsVar);
|
|
477
|
+
if (existsType.name !== 'exists' || existsType.children.length !== 2) {
|
|
478
|
+
throw new VerificationError(`Line ${step.lineNum}: Variable '${existsVar}' must have type exists(var(name, type), body)`);
|
|
479
|
+
}
|
|
480
|
+
const varExpr = existsType.children[0];
|
|
481
|
+
if (varExpr.name !== 'var' || varExpr.children.length !== 2) {
|
|
482
|
+
throw new VerificationError(`Line ${step.lineNum}: exists must have var(name, type) as first argument`);
|
|
483
|
+
}
|
|
484
|
+
const boundVarName = varExpr.children[0].name;
|
|
485
|
+
const witnessType = varExpr.children[1];
|
|
486
|
+
const body = existsType.children[1];
|
|
487
|
+
// Add witness variable and hypothesis variable
|
|
488
|
+
context.addVariable(witnessVar, witnessType);
|
|
489
|
+
const hypType = body.substitute(boundVarName, new Expression(witnessVar));
|
|
490
|
+
context.addVariable(hypVar, hypType);
|
|
491
|
+
return false; // Does not resolve goal
|
|
492
|
+
}
|
|
493
|
+
/**
|
|
494
|
+
* Verify we-have: prove intermediate result.
|
|
495
|
+
*/
|
|
496
|
+
function verifyWeHave(step, context, axiomsAndTheorems, verbose) {
|
|
497
|
+
if (step.args.length !== 1) {
|
|
498
|
+
throw new VerificationError(`Line ${step.lineNum}: 'we-have' must have exactly one argument`);
|
|
499
|
+
}
|
|
500
|
+
const arg = step.args[0];
|
|
501
|
+
if (arg.name !== 'var' || arg.children.length !== 2) {
|
|
502
|
+
throw new VerificationError(`Line ${step.lineNum}: 'we-have' argument must be of form 'name : type'`);
|
|
503
|
+
}
|
|
504
|
+
const varName = arg.children[0].name;
|
|
505
|
+
const varType = arg.children[1];
|
|
506
|
+
if (context.hasVariable(varName)) {
|
|
507
|
+
throw new VerificationError(`Line ${step.lineNum}: Variable '${varName}' already in context`);
|
|
508
|
+
}
|
|
509
|
+
if (step.children.length !== 1 || step.children[0].blockType !== 'proof') {
|
|
510
|
+
throw new VerificationError(`Line ${step.lineNum}: 'we-have' must have exactly one 'proof' child`);
|
|
511
|
+
}
|
|
512
|
+
// Verify the proof with the new goal
|
|
513
|
+
const subContext = context.copy();
|
|
514
|
+
subContext.goal = varType;
|
|
515
|
+
const resolved = verifyProof(step.children[0], subContext, axiomsAndTheorems, verbose);
|
|
516
|
+
if (!resolved) {
|
|
517
|
+
throw new VerificationError(`Line ${step.lineNum}: Proof does not establish ${varType}`);
|
|
518
|
+
}
|
|
519
|
+
context.addVariable(varName, varType);
|
|
520
|
+
return false; // Does not resolve goal
|
|
521
|
+
}
|
|
522
|
+
/**
|
|
523
|
+
* Verify focus-or: goal must be or(a, b), focus on left or right.
|
|
524
|
+
*/
|
|
525
|
+
function verifyFocusOr(step, context) {
|
|
526
|
+
if (step.args.length !== 1) {
|
|
527
|
+
throw new VerificationError(`Line ${step.lineNum}: 'focus-or' takes exactly one argument`);
|
|
528
|
+
}
|
|
529
|
+
const direction = step.args[0].name;
|
|
530
|
+
if (step.args[0].children.length > 0 || (direction !== 'left' && direction !== 'right')) {
|
|
531
|
+
throw new VerificationError(`Line ${step.lineNum}: 'focus-or' argument must be 'left' or 'right'`);
|
|
532
|
+
}
|
|
533
|
+
if (context.goal === null) {
|
|
534
|
+
throw new VerificationError(`Line ${step.lineNum}: No goal for focus-or`);
|
|
535
|
+
}
|
|
536
|
+
if (context.goal.name !== 'or' || context.goal.children.length !== 2) {
|
|
537
|
+
throw new VerificationError(`Line ${step.lineNum}: Goal must be or(a, b), got ${context.goal}`);
|
|
538
|
+
}
|
|
539
|
+
if (direction === 'left') {
|
|
540
|
+
context.goal = context.goal.children[0];
|
|
541
|
+
}
|
|
542
|
+
else {
|
|
543
|
+
context.goal = context.goal.children[1];
|
|
544
|
+
}
|
|
545
|
+
return false; // Does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AAS,KAAK,MAAM,IAAI,SAAS,KAAK,OAAO,CAAC,EAAE,CAAC;QACtF,MAAM,IAAI,iBAAiB,CAAC,QAAQ,IAAI,CAAC,OAAO,iDAAiD,CAAC,CAAC;IACvG,CAAC;IAED,IAAI,OAAO,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;QACxB,MAAM,IAAI,iBAAiB,CAAC,QAAQ,IAAI,CAAC,OAAO,wBAAwB,CAAC,CAAC;IAC9E,CAAC;IAED,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACnE,MAAM,IAAI,iBAAiB,CAAC,QAAQ,IAAI,CAAC,OAAO,gCAAgC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IACpG,CAAC;IAED,IAAI,SAAS,KAAK,MAAM,EAAE,CAAC;QACvB,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC5C,CAAC;SAAM,CAAC;QACJ,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC5C,CAAC;IAED,OAAO,KAAK,CAAC,CAAC,wBAAwB;AAC1C,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "proofery",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "A mathematical proof verifier written in TypeScript",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"proofery": "./dist/cli.js"
|
|
10
|
+
},
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"require": "./dist/index.js",
|
|
15
|
+
"import": "./dist/index.js"
|
|
16
|
+
},
|
|
17
|
+
"./nodeParser": {
|
|
18
|
+
"types": "./dist/nodeParser.d.ts",
|
|
19
|
+
"require": "./dist/nodeParser.js",
|
|
20
|
+
"import": "./dist/nodeParser.js"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist",
|
|
25
|
+
"README.md",
|
|
26
|
+
"LICENSE"
|
|
27
|
+
],
|
|
28
|
+
"scripts": {
|
|
29
|
+
"build": "tsc",
|
|
30
|
+
"start": "node dist/index.js",
|
|
31
|
+
"dev": "tsc && node dist/index.js"
|
|
32
|
+
},
|
|
33
|
+
"keywords": [
|
|
34
|
+
"proof",
|
|
35
|
+
"verification",
|
|
36
|
+
"mathematics",
|
|
37
|
+
"theorem"
|
|
38
|
+
],
|
|
39
|
+
"author": "Jeremy Magland",
|
|
40
|
+
"license": "MIT",
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@types/node": "^20.0.0",
|
|
43
|
+
"typescript": "^5.3.0"
|
|
44
|
+
},
|
|
45
|
+
"engines": {
|
|
46
|
+
"node": ">=18.0.0"
|
|
47
|
+
}
|
|
48
|
+
}
|