proofery 0.1.0 → 0.1.1
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/README.md +98 -56
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# proofery
|
|
2
2
|
|
|
3
|
+
> **⚠️ WORK IN PROGRESS - PROTOTYPE ⚠️**
|
|
4
|
+
>
|
|
5
|
+
> **This project is currently a prototype and proof verification is not yet rigorous.**
|
|
6
|
+
>
|
|
7
|
+
> The verification logic is still under development and should not be relied upon for critical mathematical work. Use at your own risk for experimental purposes only.
|
|
8
|
+
|
|
3
9
|
A mathematical proof verifier.
|
|
4
10
|
|
|
5
11
|
## Overview
|
|
@@ -21,32 +27,49 @@ Use it as a CLI tool to verify `.prf` files, or import it as a library to integr
|
|
|
21
27
|
|
|
22
28
|
## Installation
|
|
23
29
|
|
|
24
|
-
|
|
30
|
+
```bash
|
|
31
|
+
npm install proofery
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Or use directly with npx (no installation required):
|
|
25
35
|
|
|
26
36
|
```bash
|
|
27
|
-
|
|
28
|
-
npm install
|
|
29
|
-
npm run build
|
|
37
|
+
npx proofery example.prf
|
|
30
38
|
```
|
|
31
39
|
|
|
32
|
-
###
|
|
40
|
+
### Development Installation (from source)
|
|
41
|
+
|
|
42
|
+
If you want to contribute or modify the code:
|
|
33
43
|
|
|
34
44
|
```bash
|
|
35
|
-
|
|
45
|
+
git clone <repository-url>
|
|
46
|
+
cd proofery
|
|
47
|
+
npm install
|
|
48
|
+
npm run build
|
|
36
49
|
```
|
|
37
50
|
|
|
38
51
|
## Usage
|
|
39
52
|
|
|
40
53
|
### As a Command-Line Tool
|
|
41
54
|
|
|
55
|
+
#### Using npx (recommended)
|
|
56
|
+
|
|
42
57
|
```bash
|
|
43
58
|
# Basic usage
|
|
44
|
-
|
|
59
|
+
npx proofery example.prf
|
|
45
60
|
|
|
46
61
|
# With verbose output
|
|
47
|
-
|
|
62
|
+
npx proofery --verbose example.prf
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
#### Using global installation
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
# Install globally
|
|
69
|
+
npm install -g proofery
|
|
48
70
|
|
|
49
|
-
#
|
|
71
|
+
# Then use directly
|
|
72
|
+
proofery example.prf
|
|
50
73
|
proofery --verbose example.prf
|
|
51
74
|
```
|
|
52
75
|
|
|
@@ -56,7 +79,13 @@ proofery --verbose example.prf
|
|
|
56
79
|
|
|
57
80
|
### As a Library
|
|
58
81
|
|
|
59
|
-
|
|
82
|
+
First, install the package:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
npm install proofery
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
#### In Node.js or TypeScript
|
|
60
89
|
|
|
61
90
|
```typescript
|
|
62
91
|
import { parseContent, verifyFile } from 'proofery';
|
|
@@ -70,7 +99,8 @@ theorem reflexivity
|
|
|
70
99
|
suppose x : Nat
|
|
71
100
|
conclude eq(x, x)
|
|
72
101
|
proof
|
|
73
|
-
|
|
102
|
+
calculate x
|
|
103
|
+
= x by-lhs my_axiom x
|
|
74
104
|
`;
|
|
75
105
|
|
|
76
106
|
try {
|
|
@@ -82,49 +112,50 @@ try {
|
|
|
82
112
|
}
|
|
83
113
|
```
|
|
84
114
|
|
|
115
|
+
#### Parsing from files in Node.js
|
|
116
|
+
|
|
117
|
+
```typescript
|
|
118
|
+
import { parseFileSync } from 'proofery/nodeParser';
|
|
119
|
+
import { verifyFile } from 'proofery';
|
|
120
|
+
|
|
121
|
+
const blocks = parseFileSync('example.prf');
|
|
122
|
+
verifyFile(blocks, true); // true for verbose output
|
|
123
|
+
```
|
|
124
|
+
|
|
85
125
|
#### In the Browser
|
|
86
126
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
try {
|
|
109
|
-
const blocks = parseContent(content);
|
|
110
|
-
verifyFile(blocks, false);
|
|
111
|
-
resultDiv.textContent = '✓ Proof verified successfully!';
|
|
112
|
-
resultDiv.style.color = 'green';
|
|
113
|
-
} catch (error) {
|
|
114
|
-
resultDiv.textContent = '✗ Error: ' + error.message;
|
|
115
|
-
resultDiv.style.color = 'red';
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
</script>
|
|
119
|
-
</body>
|
|
120
|
-
</html>
|
|
127
|
+
You'll need to use a bundler like webpack, vite, or esbuild to use proofery in the browser:
|
|
128
|
+
|
|
129
|
+
```javascript
|
|
130
|
+
// Using a bundler (webpack, vite, etc.)
|
|
131
|
+
import { parseContent, verifyFile } from 'proofery';
|
|
132
|
+
|
|
133
|
+
function verifyProof() {
|
|
134
|
+
const content = document.getElementById('proof-input').value;
|
|
135
|
+
const resultDiv = document.getElementById('result');
|
|
136
|
+
|
|
137
|
+
try {
|
|
138
|
+
const blocks = parseContent(content);
|
|
139
|
+
verifyFile(blocks, false);
|
|
140
|
+
resultDiv.textContent = '✓ Proof verified successfully!';
|
|
141
|
+
resultDiv.style.color = 'green';
|
|
142
|
+
} catch (error) {
|
|
143
|
+
resultDiv.textContent = '✗ Error: ' + error.message;
|
|
144
|
+
resultDiv.style.color = 'red';
|
|
145
|
+
}
|
|
146
|
+
}
|
|
121
147
|
```
|
|
122
148
|
|
|
149
|
+
For a complete browser example, see `examples/demo.html` in the repository.
|
|
150
|
+
|
|
123
151
|
#### Available Exports
|
|
124
152
|
|
|
125
153
|
```typescript
|
|
126
|
-
//
|
|
127
|
-
import { parseContent,
|
|
154
|
+
// Main functions
|
|
155
|
+
import { parseContent, verifyFile } from 'proofery';
|
|
156
|
+
|
|
157
|
+
// Node.js specific (file parsing)
|
|
158
|
+
import { parseFileSync } from 'proofery/nodeParser';
|
|
128
159
|
|
|
129
160
|
// Types
|
|
130
161
|
import { Block, Expression, Context } from 'proofery';
|
|
@@ -174,6 +205,15 @@ For complete language reference, see the original `LANGUAGE_REFERENCE.md`.
|
|
|
174
205
|
|
|
175
206
|
## Development
|
|
176
207
|
|
|
208
|
+
Want to contribute? Clone the repository and install dependencies:
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
git clone <repository-url>
|
|
212
|
+
cd proofery
|
|
213
|
+
npm install
|
|
214
|
+
npm run build
|
|
215
|
+
```
|
|
216
|
+
|
|
177
217
|
### Project Structure
|
|
178
218
|
|
|
179
219
|
```
|
|
@@ -181,7 +221,8 @@ proofery/
|
|
|
181
221
|
├── src/
|
|
182
222
|
│ ├── index.ts # Library entry point (exports)
|
|
183
223
|
│ ├── cli.ts # CLI entry point
|
|
184
|
-
│ ├──
|
|
224
|
+
│ ├── nodeParser.ts # Node.js file parser
|
|
225
|
+
│ ├── parser.ts # .prf content parser
|
|
185
226
|
│ ├── verifier.ts # Main proof verifier
|
|
186
227
|
│ ├── expression.ts # Expression tree representation
|
|
187
228
|
│ ├── block.ts # Block structure
|
|
@@ -206,21 +247,21 @@ This compiles TypeScript to JavaScript in the `dist/` directory.
|
|
|
206
247
|
|
|
207
248
|
### Testing
|
|
208
249
|
|
|
209
|
-
Test the CLI
|
|
250
|
+
Test the CLI:
|
|
210
251
|
|
|
211
252
|
```bash
|
|
212
253
|
npm run build
|
|
213
|
-
|
|
254
|
+
npx proofery --verbose examples/example.prf
|
|
214
255
|
```
|
|
215
256
|
|
|
216
257
|
Test the library API:
|
|
217
258
|
|
|
218
259
|
```bash
|
|
219
260
|
npm run build
|
|
220
|
-
node -e "
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
const content =
|
|
261
|
+
node --input-type=module -e "
|
|
262
|
+
import { parseContent, verifyFile } from './dist/index.js';
|
|
263
|
+
import { readFileSync } from 'fs';
|
|
264
|
+
const content = readFileSync('examples/example.prf', 'utf-8');
|
|
224
265
|
const blocks = parseContent(content);
|
|
225
266
|
verifyFile(blocks, true);
|
|
226
267
|
console.log('\n✓ Library API test passed!');
|
|
@@ -242,6 +283,7 @@ The verification logic and proof language remain identical to the Python version
|
|
|
242
283
|
|
|
243
284
|
MIT
|
|
244
285
|
|
|
245
|
-
##
|
|
286
|
+
## Links
|
|
246
287
|
|
|
247
|
-
|
|
288
|
+
- [npm package](https://www.npmjs.com/package/proofery)
|
|
289
|
+
- [GitHub repository](https://github.com/magland/proofery)
|