lptp-mcp-server 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 +29 -0
- package/README.md +91 -0
- package/build/backends/gprolog.d.ts +32 -0
- package/build/backends/gprolog.d.ts.map +1 -0
- package/build/backends/gprolog.js +113 -0
- package/build/backends/gprolog.js.map +1 -0
- package/build/backends/registry.d.ts +15 -0
- package/build/backends/registry.d.ts.map +1 -0
- package/build/backends/registry.js +61 -0
- package/build/backends/registry.js.map +1 -0
- package/build/backends/scryer.d.ts +33 -0
- package/build/backends/scryer.d.ts.map +1 -0
- package/build/backends/scryer.js +71 -0
- package/build/backends/scryer.js.map +1 -0
- package/build/backends/swipl.d.ts +24 -0
- package/build/backends/swipl.d.ts.map +1 -0
- package/build/backends/swipl.js +73 -0
- package/build/backends/swipl.js.map +1 -0
- package/build/backends/types.d.ts +27 -0
- package/build/backends/types.d.ts.map +1 -0
- package/build/backends/types.js +3 -0
- package/build/backends/types.js.map +1 -0
- package/build/index.d.ts +3 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +355 -0
- package/build/index.js.map +1 -0
- package/build/lptpExecutor.d.ts +19 -0
- package/build/lptpExecutor.d.ts.map +1 -0
- package/build/lptpExecutor.js +520 -0
- package/build/lptpExecutor.js.map +1 -0
- package/jest.config.js +11 -0
- package/mcp-config-example.json +12 -0
- package/package.json +41 -0
- package/src/__tests__/mcp_lptp_server.test.ts +97 -0
- package/src/backends/gprolog.ts +87 -0
- package/src/backends/registry.ts +70 -0
- package/src/backends/scryer.ts +83 -0
- package/src/backends/swipl.ts +88 -0
- package/src/backends/types.ts +36 -0
- package/src/index.ts +369 -0
- package/src/lptpExecutor.ts +551 -0
- package/tsconfig.json +26 -0
package/build/index.js
ADDED
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const index_js_1 = require("@modelcontextprotocol/sdk/server/index.js");
|
|
5
|
+
const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
6
|
+
const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
|
|
7
|
+
const lptpExecutor_1 = require("./lptpExecutor");
|
|
8
|
+
const server = new index_js_1.Server({
|
|
9
|
+
name: "LPTP-MCP-Server",
|
|
10
|
+
version: "1.0.0",
|
|
11
|
+
}, {
|
|
12
|
+
capabilities: {
|
|
13
|
+
tools: {},
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
const LPTP_GRAMMAR_SNIPPET = `
|
|
17
|
+
Term Encoding:
|
|
18
|
+
?x -> $(x) % Variable
|
|
19
|
+
0 -> [n(0, 0)] % Constant
|
|
20
|
+
heaps -> [n(heaps, 0)] % Constant
|
|
21
|
+
s(?x) -> [n(s, 1), $(x)] % Compound (successor)
|
|
22
|
+
[?h|?t] -> [n('.', 2), $(h), $(t)] % List (cons)
|
|
23
|
+
[] -> [n('[]', 0)] % Empty list
|
|
24
|
+
|
|
25
|
+
Goals:
|
|
26
|
+
true -> [&] % Empty conjunction
|
|
27
|
+
fail -> [\\/] % Empty disjunction
|
|
28
|
+
?x = s(0) -> [=, $(x), [n(s,1), [n(0,0)]]] % Equation
|
|
29
|
+
member(?x, ?l) -> [n(member, 2), $(x), $(l)] % Atom
|
|
30
|
+
~member(?x, []) -> [~, [n(member, 2), $(x), [n('[]', 0)]]] % Negation
|
|
31
|
+
G1 & G2 -> [&, G1, G2] % Conjunction
|
|
32
|
+
G1 \\/ G2 -> [\\/, G1, G2] % Disjunction
|
|
33
|
+
|
|
34
|
+
Formulas:
|
|
35
|
+
tt -> [&] % Verum
|
|
36
|
+
ff -> [\\/] % Falsum
|
|
37
|
+
s(?x) = s(?y) -> [=, [n(s,1), $(x)], [n(s,1), $(y)]]
|
|
38
|
+
succeeds A -> [succeeds, AtomInternal]
|
|
39
|
+
fails A -> [fails, AtomInternal]
|
|
40
|
+
terminates G -> [terminates, GoalInternal]
|
|
41
|
+
\u03c6 & \u03c8 -> [&, \u03c6Internal, \u03c8Internal]
|
|
42
|
+
\u03c6 \\/ \u03c8 -> [\\/, \u03c6Internal, \u03c8Internal]
|
|
43
|
+
\u03c6 => \u03c8 -> [=>, \u03c6Internal, \u03c8Internal]
|
|
44
|
+
all [x]: \u03c6 -> @(all, [x], \u03c6Internal)
|
|
45
|
+
ex [x]: \u03c6 -> @(ex, [x], \u03c6Internal)
|
|
46
|
+
`;
|
|
47
|
+
// ── Shared schema fragments ──────────────────────────────────────────
|
|
48
|
+
const formulaSchema = {
|
|
49
|
+
type: "object",
|
|
50
|
+
properties: {
|
|
51
|
+
formula: {
|
|
52
|
+
type: "string",
|
|
53
|
+
description: "The target formal mathematical expression you want to decompose applying the given tactic.",
|
|
54
|
+
},
|
|
55
|
+
context: {
|
|
56
|
+
type: "string",
|
|
57
|
+
description: "Any external required definitions or `:- needs_gr(...)` references.",
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
required: ["formula"],
|
|
61
|
+
};
|
|
62
|
+
const predicateSchema = {
|
|
63
|
+
type: "object",
|
|
64
|
+
properties: {
|
|
65
|
+
predicate_name: {
|
|
66
|
+
type: "string",
|
|
67
|
+
description: "The predicate name (e.g. 'append', 'member', 'nat').",
|
|
68
|
+
},
|
|
69
|
+
context: {
|
|
70
|
+
type: "string",
|
|
71
|
+
description: "Any external required definitions or `:- needs_gr(...)` references.",
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
required: ["predicate_name"],
|
|
75
|
+
};
|
|
76
|
+
// ── Tool definitions ─────────────────────────────────────────────────
|
|
77
|
+
server.setRequestHandler(types_js_1.ListToolsRequestSchema, async () => {
|
|
78
|
+
return {
|
|
79
|
+
tools: [
|
|
80
|
+
// ── Meta tools ───────────────────────────────────────
|
|
81
|
+
{
|
|
82
|
+
name: "get_lptp_grammar",
|
|
83
|
+
description: "Returns a basic summary of LPTP Grammar for LLM reasoning.",
|
|
84
|
+
inputSchema: {
|
|
85
|
+
type: "object",
|
|
86
|
+
properties: {},
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
// ── Proof verification ───────────────────────────────
|
|
90
|
+
{
|
|
91
|
+
name: "verify_lemma",
|
|
92
|
+
description: "Validates a snippet of LPTP proof code (e.g., lemma/3, theorem/3) by running it securely through SWI-Prolog. You can inject external context or axioms.",
|
|
93
|
+
inputSchema: {
|
|
94
|
+
type: "object",
|
|
95
|
+
properties: {
|
|
96
|
+
proof_code: {
|
|
97
|
+
type: "string",
|
|
98
|
+
description: "The complete `lemma(...)` or syntax token you expect LPTP to compile.",
|
|
99
|
+
},
|
|
100
|
+
context: {
|
|
101
|
+
type: "string",
|
|
102
|
+
description: "Definitions, :- needs_gr() statements, or axioms evaluating before the target lemma.",
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
required: ["proof_code"],
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
name: "check_proof",
|
|
110
|
+
description: "Runs LPTP's native check/1 predicate on an existing .pr proof file on disk. Returns all verification errors or confirms the entire proof is valid.",
|
|
111
|
+
inputSchema: {
|
|
112
|
+
type: "object",
|
|
113
|
+
properties: {
|
|
114
|
+
file_path: {
|
|
115
|
+
type: "string",
|
|
116
|
+
description: "Absolute path to the .pr proof file to verify with check/1.",
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
required: ["file_path"],
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
// ── Generic tactic application ───────────────────────
|
|
123
|
+
{
|
|
124
|
+
name: "apply_tactic",
|
|
125
|
+
description: "Applies an LPTP tactic (e.g., `[ind]`, `[auto(5)]`, `completion`) to a given logical formula and returns the expanded proof derivation tree generated by the theorem prover. Essential for navigating proof trees interactivity.",
|
|
126
|
+
inputSchema: {
|
|
127
|
+
type: "object",
|
|
128
|
+
properties: {
|
|
129
|
+
formula: {
|
|
130
|
+
type: "string",
|
|
131
|
+
description: "The target formal mathematical expression you want to decompose applying the given tactic.",
|
|
132
|
+
},
|
|
133
|
+
tactic: {
|
|
134
|
+
type: "string",
|
|
135
|
+
description: "The LPTP tactic token, e.g. `[ind]`, `[auto(5)]`, `[unfold]`, `completion`.",
|
|
136
|
+
},
|
|
137
|
+
context: {
|
|
138
|
+
type: "string",
|
|
139
|
+
description: "Any external required definitions or `:- needs_gr(...)` references.",
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
required: ["formula", "tactic"],
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
// ── Individual tactics (from etc/lptp-swi-prolog-mode.el) ──
|
|
146
|
+
{
|
|
147
|
+
name: "tactic_auto",
|
|
148
|
+
description: "Try to prove the formula automatically using LPTP's auto tactic with configurable search depth. Combines multiple proof strategies. Resource-limited: uses call_with_inference_limit/3 and call_with_time_limit/2 to prevent hangs.",
|
|
149
|
+
inputSchema: {
|
|
150
|
+
type: "object",
|
|
151
|
+
properties: {
|
|
152
|
+
formula: {
|
|
153
|
+
type: "string",
|
|
154
|
+
description: "The target formal mathematical expression to prove.",
|
|
155
|
+
},
|
|
156
|
+
depth: {
|
|
157
|
+
type: "number",
|
|
158
|
+
description: "Search depth for automatic proof (default: 5).",
|
|
159
|
+
},
|
|
160
|
+
context: {
|
|
161
|
+
type: "string",
|
|
162
|
+
description: "Any external required definitions or `:- needs_gr(...)` references.",
|
|
163
|
+
},
|
|
164
|
+
inference_limit: {
|
|
165
|
+
type: "number",
|
|
166
|
+
description: "Max inference steps before aborting (default: 1000000). Use lower values (e.g. 50000) for bisection scouting.",
|
|
167
|
+
},
|
|
168
|
+
time_limit_seconds: {
|
|
169
|
+
type: "number",
|
|
170
|
+
description: "Max wall-clock seconds before aborting (default: 25). Use lower values (e.g. 5) for fast scouting.",
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
required: ["formula"],
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
name: "tactic_case",
|
|
178
|
+
description: "Try to prove the formula by case splitting on disjunctions or pattern matches.",
|
|
179
|
+
inputSchema: formulaSchema,
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
name: "tactic_comp",
|
|
183
|
+
description: "Try to prove the formula by taking a completion formula (fixed-point semantics of program clauses).",
|
|
184
|
+
inputSchema: formulaSchema,
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
name: "tactic_elim",
|
|
188
|
+
description: "Try to prove the formula by expanding (eliminating) a predicate definition.",
|
|
189
|
+
inputSchema: formulaSchema,
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
name: "tactic_ex",
|
|
193
|
+
description: "Try to prove the formula by existential elimination (instantiating an existential quantifier).",
|
|
194
|
+
inputSchema: formulaSchema,
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
name: "tactic_fact",
|
|
198
|
+
description: "Try to prove the formula by applying a known fact (lemma, theorem, corollary, or axiom).",
|
|
199
|
+
inputSchema: formulaSchema,
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
name: "tactic_ind",
|
|
203
|
+
description: "Try to prove the formula by structural induction on an inductively defined predicate.",
|
|
204
|
+
inputSchema: formulaSchema,
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
name: "tactic_indqf",
|
|
208
|
+
description: "Try to prove the formula by quantifier-free induction (induction without universally quantified induction hypothesis).",
|
|
209
|
+
inputSchema: formulaSchema,
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
name: "tactic_tot",
|
|
213
|
+
description: "Try to prove the formula by case splitting on totality (termination) of a predicate call.",
|
|
214
|
+
inputSchema: formulaSchema,
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
name: "tactic_unfold",
|
|
218
|
+
description: "Try to prove the formula by unfolding an abbreviation or definition.",
|
|
219
|
+
inputSchema: formulaSchema,
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
name: "tactic_debug",
|
|
223
|
+
description: "Show the available formulas and assumptions in the current proof context. Useful for understanding what facts are available to complete a proof step.",
|
|
224
|
+
inputSchema: formulaSchema,
|
|
225
|
+
},
|
|
226
|
+
// ── Query tools ──────────────────────────────────────
|
|
227
|
+
{
|
|
228
|
+
name: "print_definition",
|
|
229
|
+
description: "Print the completion definition of a predicate. Shows the IND(P) fixed-point axioms (success, failure, termination) generated from the program clauses.",
|
|
230
|
+
inputSchema: predicateSchema,
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
name: "list_facts",
|
|
234
|
+
description: "List all known theorems, lemmas, and corollaries about a predicate. Useful for discovering what has already been proved.",
|
|
235
|
+
inputSchema: predicateSchema,
|
|
236
|
+
},
|
|
237
|
+
// ── Compilation ──────────────────────────────────────
|
|
238
|
+
{
|
|
239
|
+
name: "compile_gr",
|
|
240
|
+
description: "Compiles a .pl (Prolog program) file into its LPTP ground representation (.gr). The .gr file is written next to the .pl source. Accepts LPTP alias paths (e.g. '$(examples)/gen_99p/list_ops') or filesystem paths (e.g. 'examples/gen_99p/list_ops'). Path must omit the .pl extension.",
|
|
241
|
+
inputSchema: {
|
|
242
|
+
type: "object",
|
|
243
|
+
properties: {
|
|
244
|
+
file_path: {
|
|
245
|
+
type: "string",
|
|
246
|
+
description: "Path to the .pl file WITHOUT the .pl extension. Supports LPTP aliases like $(examples), $(lib) or filesystem paths.",
|
|
247
|
+
},
|
|
248
|
+
},
|
|
249
|
+
required: ["file_path"],
|
|
250
|
+
},
|
|
251
|
+
},
|
|
252
|
+
],
|
|
253
|
+
};
|
|
254
|
+
});
|
|
255
|
+
// ── Tool dispatch ────────────────────────────────────────────────────
|
|
256
|
+
server.setRequestHandler(types_js_1.CallToolRequestSchema, async (request) => {
|
|
257
|
+
const args = request.params.arguments;
|
|
258
|
+
switch (request.params.name) {
|
|
259
|
+
case "get_lptp_grammar": {
|
|
260
|
+
return {
|
|
261
|
+
content: [{ type: "text", text: LPTP_GRAMMAR_SNIPPET }],
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
case "verify_lemma": {
|
|
265
|
+
const result = await (0, lptpExecutor_1.verifyLemma)(args.proof_code, args.context || "");
|
|
266
|
+
return { content: [{ type: "text", text: result.output }] };
|
|
267
|
+
}
|
|
268
|
+
case "check_proof": {
|
|
269
|
+
const result = await (0, lptpExecutor_1.checkProof)(args.file_path);
|
|
270
|
+
return { content: [{ type: "text", text: result.output }] };
|
|
271
|
+
}
|
|
272
|
+
case "compile_gr": {
|
|
273
|
+
const result = await (0, lptpExecutor_1.compileGr)(args.file_path);
|
|
274
|
+
return { content: [{ type: "text", text: result.output }] };
|
|
275
|
+
}
|
|
276
|
+
// ── Generic tactic ───────────────────────────────────
|
|
277
|
+
case "apply_tactic": {
|
|
278
|
+
const result = await (0, lptpExecutor_1.applyTactic)(args.formula, args.tactic, args.context || "");
|
|
279
|
+
return { content: [{ type: "text", text: result.output }] };
|
|
280
|
+
}
|
|
281
|
+
// ── Individual tactics ───────────────────────────────
|
|
282
|
+
case "tactic_auto": {
|
|
283
|
+
const depth = args.depth ?? 5;
|
|
284
|
+
const limits = {};
|
|
285
|
+
if (args.inference_limit != null)
|
|
286
|
+
limits.inferenceLimit = args.inference_limit;
|
|
287
|
+
if (args.time_limit_seconds != null)
|
|
288
|
+
limits.timeLimitS = args.time_limit_seconds;
|
|
289
|
+
const result = await (0, lptpExecutor_1.applyTactic)(args.formula, `[auto(${depth})]`, args.context || "", limits);
|
|
290
|
+
return { content: [{ type: "text", text: result.output }] };
|
|
291
|
+
}
|
|
292
|
+
case "tactic_case": {
|
|
293
|
+
const result = await (0, lptpExecutor_1.applyTactic)(args.formula, "[case]", args.context || "");
|
|
294
|
+
return { content: [{ type: "text", text: result.output }] };
|
|
295
|
+
}
|
|
296
|
+
case "tactic_comp": {
|
|
297
|
+
const result = await (0, lptpExecutor_1.applyTactic)(args.formula, "[comp]", args.context || "");
|
|
298
|
+
return { content: [{ type: "text", text: result.output }] };
|
|
299
|
+
}
|
|
300
|
+
case "tactic_elim": {
|
|
301
|
+
const result = await (0, lptpExecutor_1.applyTactic)(args.formula, "[elim]", args.context || "");
|
|
302
|
+
return { content: [{ type: "text", text: result.output }] };
|
|
303
|
+
}
|
|
304
|
+
case "tactic_ex": {
|
|
305
|
+
const result = await (0, lptpExecutor_1.applyTactic)(args.formula, "[ex]", args.context || "");
|
|
306
|
+
return { content: [{ type: "text", text: result.output }] };
|
|
307
|
+
}
|
|
308
|
+
case "tactic_fact": {
|
|
309
|
+
const result = await (0, lptpExecutor_1.applyTactic)(args.formula, "[fact]", args.context || "");
|
|
310
|
+
return { content: [{ type: "text", text: result.output }] };
|
|
311
|
+
}
|
|
312
|
+
case "tactic_ind": {
|
|
313
|
+
const result = await (0, lptpExecutor_1.applyTactic)(args.formula, "[ind]", args.context || "");
|
|
314
|
+
return { content: [{ type: "text", text: result.output }] };
|
|
315
|
+
}
|
|
316
|
+
case "tactic_indqf": {
|
|
317
|
+
const result = await (0, lptpExecutor_1.applyTactic)(args.formula, "[indqf]", args.context || "");
|
|
318
|
+
return { content: [{ type: "text", text: result.output }] };
|
|
319
|
+
}
|
|
320
|
+
case "tactic_tot": {
|
|
321
|
+
const result = await (0, lptpExecutor_1.applyTactic)(args.formula, "[tot]", args.context || "");
|
|
322
|
+
return { content: [{ type: "text", text: result.output }] };
|
|
323
|
+
}
|
|
324
|
+
case "tactic_unfold": {
|
|
325
|
+
const result = await (0, lptpExecutor_1.applyTactic)(args.formula, "[unfold]", args.context || "");
|
|
326
|
+
return { content: [{ type: "text", text: result.output }] };
|
|
327
|
+
}
|
|
328
|
+
case "tactic_debug": {
|
|
329
|
+
const result = await (0, lptpExecutor_1.applyTactic)(args.formula, "[debug]", args.context || "");
|
|
330
|
+
return { content: [{ type: "text", text: result.output }] };
|
|
331
|
+
}
|
|
332
|
+
// ── Query tools ──────────────────────────────────────
|
|
333
|
+
case "print_definition": {
|
|
334
|
+
const result = await (0, lptpExecutor_1.printDefinition)(args.predicate_name, args.context || "");
|
|
335
|
+
return { content: [{ type: "text", text: result.output }] };
|
|
336
|
+
}
|
|
337
|
+
case "list_facts": {
|
|
338
|
+
const result = await (0, lptpExecutor_1.listFacts)(args.predicate_name, args.context || "");
|
|
339
|
+
return { content: [{ type: "text", text: result.output }] };
|
|
340
|
+
}
|
|
341
|
+
default:
|
|
342
|
+
throw new Error("Unknown tool");
|
|
343
|
+
}
|
|
344
|
+
});
|
|
345
|
+
async function runServer() {
|
|
346
|
+
const transport = new stdio_js_1.StdioServerTransport();
|
|
347
|
+
await server.connect(transport);
|
|
348
|
+
console.error("LPTP-MCP-Server running on stdio");
|
|
349
|
+
}
|
|
350
|
+
runServer().catch((error) => {
|
|
351
|
+
console.error("Failed to run MCP Server:");
|
|
352
|
+
console.error(error);
|
|
353
|
+
process.exit(1);
|
|
354
|
+
});
|
|
355
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAEA,wEAAmE;AACnE,wEAAiF;AACjF,iEAG4C;AAC5C,iDAA6G;AAE7G,MAAM,MAAM,GAAG,IAAI,iBAAM,CACrB;IACI,IAAI,EAAE,iBAAiB;IACvB,OAAO,EAAE,OAAO;CACnB,EACD;IACI,YAAY,EAAE;QACV,KAAK,EAAE,EAAE;KACZ;CACJ,CACJ,CAAC;AAEF,MAAM,oBAAoB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8B5B,CAAC;AAEF,wEAAwE;AAExE,MAAM,aAAa,GAAG;IAClB,IAAI,EAAE,QAAiB;IACvB,UAAU,EAAE;QACR,OAAO,EAAE;YACL,IAAI,EAAE,QAAiB;YACvB,WAAW,EAAE,4FAA4F;SAC5G;QACD,OAAO,EAAE;YACL,IAAI,EAAE,QAAiB;YACvB,WAAW,EAAE,qEAAqE;SACrF;KACJ;IACD,QAAQ,EAAE,CAAC,SAAS,CAAC;CACxB,CAAC;AAEF,MAAM,eAAe,GA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nings?: number;
|
|
7
|
+
errors?: number;
|
|
8
|
+
}
|
|
9
|
+
export declare function verifyLemma(proofCode: string, context?: string): Promise<ExecutionResult>;
|
|
10
|
+
export declare function applyTactic(formula: string, tactic: string, context?: string, limits?: {
|
|
11
|
+
timeLimitS?: number;
|
|
12
|
+
inferenceLimit?: number;
|
|
13
|
+
depthLimit?: number;
|
|
14
|
+
}): Promise<ExecutionResult>;
|
|
15
|
+
export declare function compileGr(filePath: string): Promise<ExecutionResult>;
|
|
16
|
+
export declare function printDefinition(predicateName: string, context?: string): Promise<ExecutionResult>;
|
|
17
|
+
export declare function listFacts(predicateName: string, context?: string): Promise<ExecutionResult>;
|
|
18
|
+
export declare function checkProof(filePath: string): Promise<ExecutionResult>;
|
|
19
|
+
//# sourceMappingURL=lptpExecutor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lptpExecutor.d.ts","sourceRoot":"","sources":["../src/lptpExecutor.ts"],"names":[],"mappings":"AAyDA,MAAM,WAAW,eAAe;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAkDD,wBAAsB,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,GAAE,MAAW,GAAG,OAAO,CAAC,eAAe,CAAC,CAiEnG;AAED,wBAAsB,WAAW,CAC7B,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,MAAW,EACpB,MAAM,GAAE;IAAE,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAO,GACnF,OAAO,CAAC,eAAe,CAAC,CAiF1B;AAED,wBAAsB,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CA6D1E;AAED,wBAAsB,eAAe,CAAC,aAAa,EAAE,MAAM,EAAE,OAAO,GAAE,MAAW,GAAG,OAAO,CAAC,eAAe,CAAC,CAsE3G;AAED,wBAAsB,SAAS,CAAC,aAAa,EAAE,MAAM,EAAE,OAAO,GAAE,MAAW,GAAG,OAAO,CAAC,eAAe,CAAC,CAqDrG;AAED,wBAAsB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CA2F3E"}
|