@stevenvo780/st-lang 4.9.0 → 4.10.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/dist/logic/profiles/natural-deduction-nk/formula.d.ts +18 -0
- package/dist/logic/profiles/natural-deduction-nk/formula.d.ts.map +1 -0
- package/dist/logic/profiles/natural-deduction-nk/formula.js +102 -0
- package/dist/logic/profiles/natural-deduction-nk/formula.js.map +1 -0
- package/dist/logic/profiles/natural-deduction-nk/index.d.ts +5 -0
- package/dist/logic/profiles/natural-deduction-nk/index.d.ts.map +1 -0
- package/dist/logic/profiles/natural-deduction-nk/index.js +28 -0
- package/dist/logic/profiles/natural-deduction-nk/index.js.map +1 -0
- package/dist/logic/profiles/natural-deduction-nk/prover.d.ts +49 -0
- package/dist/logic/profiles/natural-deduction-nk/prover.d.ts.map +1 -0
- package/dist/logic/profiles/natural-deduction-nk/prover.js +557 -0
- package/dist/logic/profiles/natural-deduction-nk/prover.js.map +1 -0
- package/dist/logic/profiles/natural-deduction-nk/types.d.ts +48 -0
- package/dist/logic/profiles/natural-deduction-nk/types.d.ts.map +1 -0
- package/dist/logic/profiles/natural-deduction-nk/types.js +35 -0
- package/dist/logic/profiles/natural-deduction-nk/types.js.map +1 -0
- package/dist/reasoning/automata/dfa.d.ts +17 -0
- package/dist/reasoning/automata/dfa.d.ts.map +1 -0
- package/dist/reasoning/automata/dfa.js +276 -0
- package/dist/reasoning/automata/dfa.js.map +1 -0
- package/dist/reasoning/automata/index.d.ts +8 -0
- package/dist/reasoning/automata/index.d.ts.map +1 -0
- package/dist/reasoning/automata/index.js +64 -0
- package/dist/reasoning/automata/index.js.map +1 -0
- package/dist/reasoning/automata/languages.d.ts +10 -0
- package/dist/reasoning/automata/languages.d.ts.map +1 -0
- package/dist/reasoning/automata/languages.js +78 -0
- package/dist/reasoning/automata/languages.js.map +1 -0
- package/dist/reasoning/automata/nfa.d.ts +8 -0
- package/dist/reasoning/automata/nfa.d.ts.map +1 -0
- package/dist/reasoning/automata/nfa.js +122 -0
- package/dist/reasoning/automata/nfa.js.map +1 -0
- package/dist/reasoning/automata/pda.d.ts +10 -0
- package/dist/reasoning/automata/pda.d.ts.map +1 -0
- package/dist/reasoning/automata/pda.js +169 -0
- package/dist/reasoning/automata/pda.js.map +1 -0
- package/dist/reasoning/automata/regex.d.ts +6 -0
- package/dist/reasoning/automata/regex.d.ts.map +1 -0
- package/dist/reasoning/automata/regex.js +259 -0
- package/dist/reasoning/automata/regex.js.map +1 -0
- package/dist/reasoning/automata/types.d.ts +69 -0
- package/dist/reasoning/automata/types.d.ts.map +1 -0
- package/dist/reasoning/automata/types.js +29 -0
- package/dist/reasoning/automata/types.js.map +1 -0
- package/dist/reasoning/computability/index.d.ts +239 -0
- package/dist/reasoning/computability/index.d.ts.map +1 -0
- package/dist/reasoning/computability/index.js +851 -0
- package/dist/reasoning/computability/index.js.map +1 -0
- package/dist/reasoning/number-theory/crt.d.ts +9 -0
- package/dist/reasoning/number-theory/crt.d.ts.map +1 -0
- package/dist/reasoning/number-theory/crt.js +39 -0
- package/dist/reasoning/number-theory/crt.js.map +1 -0
- package/dist/reasoning/number-theory/diophantine.d.ts +10 -0
- package/dist/reasoning/number-theory/diophantine.d.ts.map +1 -0
- package/dist/reasoning/number-theory/diophantine.js +87 -0
- package/dist/reasoning/number-theory/diophantine.js.map +1 -0
- package/dist/reasoning/number-theory/factorization.d.ts +12 -0
- package/dist/reasoning/number-theory/factorization.d.ts.map +1 -0
- package/dist/reasoning/number-theory/factorization.js +136 -0
- package/dist/reasoning/number-theory/factorization.js.map +1 -0
- package/dist/reasoning/number-theory/gcd.d.ts +8 -0
- package/dist/reasoning/number-theory/gcd.d.ts.map +1 -0
- package/dist/reasoning/number-theory/gcd.js +51 -0
- package/dist/reasoning/number-theory/gcd.js.map +1 -0
- package/dist/reasoning/number-theory/index.d.ts +9 -0
- package/dist/reasoning/number-theory/index.d.ts.map +1 -0
- package/dist/reasoning/number-theory/index.js +46 -0
- package/dist/reasoning/number-theory/index.js.map +1 -0
- package/dist/reasoning/number-theory/modular.d.ts +6 -0
- package/dist/reasoning/number-theory/modular.d.ts.map +1 -0
- package/dist/reasoning/number-theory/modular.js +75 -0
- package/dist/reasoning/number-theory/modular.js.map +1 -0
- package/dist/reasoning/number-theory/primality.d.ts +6 -0
- package/dist/reasoning/number-theory/primality.d.ts.map +1 -0
- package/dist/reasoning/number-theory/primality.js +144 -0
- package/dist/reasoning/number-theory/primality.js.map +1 -0
- package/dist/reasoning/number-theory/symbols.d.ts +3 -0
- package/dist/reasoning/number-theory/symbols.d.ts.map +1 -0
- package/dist/reasoning/number-theory/symbols.js +57 -0
- package/dist/reasoning/number-theory/symbols.js.map +1 -0
- package/dist/reasoning/real-analysis/index.d.ts +127 -0
- package/dist/reasoning/real-analysis/index.d.ts.map +1 -0
- package/dist/reasoning/real-analysis/index.js +638 -0
- package/dist/reasoning/real-analysis/index.js.map +1 -0
- package/dist/reasoning/topology/index.d.ts +41 -0
- package/dist/reasoning/topology/index.d.ts.map +1 -0
- package/dist/reasoning/topology/index.js +739 -0
- package/dist/reasoning/topology/index.js.map +1 -0
- package/dist/tests/logic/profiles/natural-deduction-nk/nk.test.d.ts +2 -0
- package/dist/tests/logic/profiles/natural-deduction-nk/nk.test.d.ts.map +1 -0
- package/dist/tests/logic/profiles/natural-deduction-nk/nk.test.js +288 -0
- package/dist/tests/logic/profiles/natural-deduction-nk/nk.test.js.map +1 -0
- package/dist/tests/reasoning/automata/automata.test.d.ts +2 -0
- package/dist/tests/reasoning/automata/automata.test.d.ts.map +1 -0
- package/dist/tests/reasoning/automata/automata.test.js +310 -0
- package/dist/tests/reasoning/automata/automata.test.js.map +1 -0
- package/dist/tests/reasoning/computability/computability.test.d.ts +2 -0
- package/dist/tests/reasoning/computability/computability.test.d.ts.map +1 -0
- package/dist/tests/reasoning/computability/computability.test.js +246 -0
- package/dist/tests/reasoning/computability/computability.test.js.map +1 -0
- package/dist/tests/reasoning/number-theory/number-theory.test.d.ts +2 -0
- package/dist/tests/reasoning/number-theory/number-theory.test.d.ts.map +1 -0
- package/dist/tests/reasoning/number-theory/number-theory.test.js +170 -0
- package/dist/tests/reasoning/number-theory/number-theory.test.js.map +1 -0
- package/dist/tests/reasoning/real-analysis/real-analysis.test.d.ts +2 -0
- package/dist/tests/reasoning/real-analysis/real-analysis.test.d.ts.map +1 -0
- package/dist/tests/reasoning/real-analysis/real-analysis.test.js +197 -0
- package/dist/tests/reasoning/real-analysis/real-analysis.test.js.map +1 -0
- package/dist/tests/reasoning/topology/topology.test.d.ts +2 -0
- package/dist/tests/reasoning/topology/topology.test.d.ts.map +1 -0
- package/dist/tests/reasoning/topology/topology.test.js +327 -0
- package/dist/tests/reasoning/topology/topology.test.js.map +1 -0
- package/dist/tests/tooling/exporters/lean4/lean4-exporter.test.d.ts +2 -0
- package/dist/tests/tooling/exporters/lean4/lean4-exporter.test.d.ts.map +1 -0
- package/dist/tests/tooling/exporters/lean4/lean4-exporter.test.js +473 -0
- package/dist/tests/tooling/exporters/lean4/lean4-exporter.test.js.map +1 -0
- package/dist/tooling/exporters/lean4/index.d.ts +47 -0
- package/dist/tooling/exporters/lean4/index.d.ts.map +1 -0
- package/dist/tooling/exporters/lean4/index.js +423 -0
- package/dist/tooling/exporters/lean4/index.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,423 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ============================================================
|
|
3
|
+
// ST Exporters — Lean 4 code generator (classical profile)
|
|
4
|
+
// ============================================================
|
|
5
|
+
// Converts ST Formula AST and Proof objects into valid Lean 4
|
|
6
|
+
// source code. Differences vs. Coq exporter:
|
|
7
|
+
// - Uses Unicode connectives (∧ ∨ → ¬ ↔) instead of ASCII.
|
|
8
|
+
// - Definitions use `:=` and theorems use `theorem ... := by ...`.
|
|
9
|
+
// - Tactics use Lean 4 vocabulary: `intro`, `exact`, `constructor`,
|
|
10
|
+
// `obtain ⟨...⟩`, `cases`, `left`/`right`, `exfalso`, etc.
|
|
11
|
+
// - Imports list controls Mathlib vs. core; default pulls in
|
|
12
|
+
// `Mathlib.Tactic` for `tauto`, `exact?`, `Classical.em`, etc.
|
|
13
|
+
// ============================================================
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.LEAN4_OPS = exports.COMMON_IMPORTS = void 0;
|
|
16
|
+
exports.formulaToLeanTerm = formulaToLeanTerm;
|
|
17
|
+
exports.leanTacticForRule = leanTacticForRule;
|
|
18
|
+
exports.exportToLean4 = exportToLean4;
|
|
19
|
+
exports.exportProofToLean4 = exportProofToLean4;
|
|
20
|
+
exports.exportTheoryToLean4 = exportTheoryToLean4;
|
|
21
|
+
// ----------------------------------------------------------------
|
|
22
|
+
// Common imports presets
|
|
23
|
+
// ----------------------------------------------------------------
|
|
24
|
+
exports.COMMON_IMPORTS = {
|
|
25
|
+
/** Lean 4 core only — no Mathlib needed. */
|
|
26
|
+
minimal: [],
|
|
27
|
+
/** Init prelude only — same as the empty list but explicit. */
|
|
28
|
+
standard: ['Init'],
|
|
29
|
+
/** Mathlib tactic suite — enables `tauto`, `exact?`, `Classical.em`. */
|
|
30
|
+
mathlib: ['Mathlib.Tactic'],
|
|
31
|
+
};
|
|
32
|
+
// ----------------------------------------------------------------
|
|
33
|
+
// Symbol mapping
|
|
34
|
+
// ----------------------------------------------------------------
|
|
35
|
+
/**
|
|
36
|
+
* Maps ST/Unicode logical operators to their Lean 4 surface syntax.
|
|
37
|
+
* Lean 4 happens to accept the same Unicode glyphs, but we keep the
|
|
38
|
+
* map explicit so downstream tooling can introspect the mapping.
|
|
39
|
+
*/
|
|
40
|
+
exports.LEAN4_OPS = new Map([
|
|
41
|
+
['not', '¬'],
|
|
42
|
+
['and', '∧'],
|
|
43
|
+
['or', '∨'],
|
|
44
|
+
['implies', '→'],
|
|
45
|
+
['biconditional', '↔'],
|
|
46
|
+
['forall', '∀'],
|
|
47
|
+
['exists', '∃'],
|
|
48
|
+
['true', 'True'],
|
|
49
|
+
['false', 'False'],
|
|
50
|
+
]);
|
|
51
|
+
// ----------------------------------------------------------------
|
|
52
|
+
// Formula → Lean 4 term
|
|
53
|
+
// ----------------------------------------------------------------
|
|
54
|
+
/**
|
|
55
|
+
* Converts an ST Formula AST node into a Lean 4 Prop expression string.
|
|
56
|
+
* Unsupported kinds emit `(/- unsupported: <kind> -/)` so dropped
|
|
57
|
+
* sub-trees are visible to the reader.
|
|
58
|
+
*/
|
|
59
|
+
function formulaToLeanTerm(formula) {
|
|
60
|
+
switch (formula.kind) {
|
|
61
|
+
case 'atom':
|
|
62
|
+
return formula.name ?? 'UnknownAtom';
|
|
63
|
+
case 'true':
|
|
64
|
+
return 'True';
|
|
65
|
+
case 'false':
|
|
66
|
+
return 'False';
|
|
67
|
+
case 'not': {
|
|
68
|
+
const inner = formula.args?.[0];
|
|
69
|
+
if (!inner)
|
|
70
|
+
return '(/- missing arg for not -/)';
|
|
71
|
+
const innerStr = formulaToLeanTerm(inner);
|
|
72
|
+
return needsParens(inner) ? `(¬ (${innerStr}))` : `(¬ ${innerStr})`;
|
|
73
|
+
}
|
|
74
|
+
case 'and': {
|
|
75
|
+
const left = formula.args?.[0];
|
|
76
|
+
const right = formula.args?.[1];
|
|
77
|
+
if (!left || !right)
|
|
78
|
+
return '(/- missing args for and -/)';
|
|
79
|
+
return `(${formulaToLeanTerm(left)} ∧ ${formulaToLeanTerm(right)})`;
|
|
80
|
+
}
|
|
81
|
+
case 'or': {
|
|
82
|
+
const left = formula.args?.[0];
|
|
83
|
+
const right = formula.args?.[1];
|
|
84
|
+
if (!left || !right)
|
|
85
|
+
return '(/- missing args for or -/)';
|
|
86
|
+
return `(${formulaToLeanTerm(left)} ∨ ${formulaToLeanTerm(right)})`;
|
|
87
|
+
}
|
|
88
|
+
case 'implies': {
|
|
89
|
+
const antecedent = formula.args?.[0];
|
|
90
|
+
const consequent = formula.args?.[1];
|
|
91
|
+
if (!antecedent || !consequent)
|
|
92
|
+
return '(/- missing args for implies -/)';
|
|
93
|
+
return `(${formulaToLeanTerm(antecedent)} → ${formulaToLeanTerm(consequent)})`;
|
|
94
|
+
}
|
|
95
|
+
case 'biconditional': {
|
|
96
|
+
const left = formula.args?.[0];
|
|
97
|
+
const right = formula.args?.[1];
|
|
98
|
+
if (!left || !right)
|
|
99
|
+
return '(/- missing args for biconditional -/)';
|
|
100
|
+
return `(${formulaToLeanTerm(left)} ↔ ${formulaToLeanTerm(right)})`;
|
|
101
|
+
}
|
|
102
|
+
case 'forall': {
|
|
103
|
+
const variable = formula.variable ?? 'x';
|
|
104
|
+
const body = formula.args?.[0];
|
|
105
|
+
if (!body)
|
|
106
|
+
return `(/- missing body for forall ${variable} -/)`;
|
|
107
|
+
return `(∀ ${variable} : Prop, ${formulaToLeanTerm(body)})`;
|
|
108
|
+
}
|
|
109
|
+
case 'exists': {
|
|
110
|
+
const variable = formula.variable ?? 'x';
|
|
111
|
+
const body = formula.args?.[0];
|
|
112
|
+
if (!body)
|
|
113
|
+
return `(/- missing body for exists ${variable} -/)`;
|
|
114
|
+
return `(∃ ${variable} : Prop, ${formulaToLeanTerm(body)})`;
|
|
115
|
+
}
|
|
116
|
+
case 'predicate': {
|
|
117
|
+
const name = formula.name ?? 'P';
|
|
118
|
+
const params = formula.params ?? formula.terms ?? [];
|
|
119
|
+
if (params.length === 0)
|
|
120
|
+
return name;
|
|
121
|
+
return `(${name} ${params.join(' ')})`;
|
|
122
|
+
}
|
|
123
|
+
default:
|
|
124
|
+
return `(/- unsupported formula kind: ${formula.kind} -/)`;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
/** Whether the formula needs outer parens when used as an argument. */
|
|
128
|
+
function needsParens(f) {
|
|
129
|
+
return (f.kind === 'and' ||
|
|
130
|
+
f.kind === 'or' ||
|
|
131
|
+
f.kind === 'implies' ||
|
|
132
|
+
f.kind === 'biconditional' ||
|
|
133
|
+
f.kind === 'forall' ||
|
|
134
|
+
f.kind === 'exists');
|
|
135
|
+
}
|
|
136
|
+
// ----------------------------------------------------------------
|
|
137
|
+
// Rule → Lean 4 tactic
|
|
138
|
+
// ----------------------------------------------------------------
|
|
139
|
+
/**
|
|
140
|
+
* Translates a natural-deduction rule label into a Lean 4 tactic.
|
|
141
|
+
* Used by callers that already know what rule they want to apply
|
|
142
|
+
* outside the context of a full proof step.
|
|
143
|
+
*/
|
|
144
|
+
function leanTacticForRule(rule) {
|
|
145
|
+
const r = rule.toLowerCase();
|
|
146
|
+
if (r.includes('modus ponens') || r === 'mp' || r.includes('modus-ponens')) {
|
|
147
|
+
return 'exact h₁ h₂';
|
|
148
|
+
}
|
|
149
|
+
if (r.includes('implies intro') || r.includes('→i') || r.includes('imp-intro') || r === 'intro') {
|
|
150
|
+
return 'intro h';
|
|
151
|
+
}
|
|
152
|
+
if (r.includes('and intro') || r.includes('∧i') || r.includes('and-intro')) {
|
|
153
|
+
return 'constructor';
|
|
154
|
+
}
|
|
155
|
+
if (r.includes('and elim left') || r.includes('∧el')) {
|
|
156
|
+
return 'exact h.left';
|
|
157
|
+
}
|
|
158
|
+
if (r.includes('and elim right') || r.includes('∧er')) {
|
|
159
|
+
return 'exact h.right';
|
|
160
|
+
}
|
|
161
|
+
if (r.includes('and elim') || r.includes('∧e')) {
|
|
162
|
+
return 'obtain ⟨hL, hR⟩ := h';
|
|
163
|
+
}
|
|
164
|
+
if (r.includes('or intro left') || r.includes('∨il')) {
|
|
165
|
+
return 'left';
|
|
166
|
+
}
|
|
167
|
+
if (r.includes('or intro right') || r.includes('∨ir')) {
|
|
168
|
+
return 'right';
|
|
169
|
+
}
|
|
170
|
+
if (r.includes('or elim') || r.includes('∨e')) {
|
|
171
|
+
return 'cases h with\n | inl hL => sorry\n | inr hR => sorry';
|
|
172
|
+
}
|
|
173
|
+
if (r.includes('not intro') || r.includes('¬i')) {
|
|
174
|
+
return 'intro habs';
|
|
175
|
+
}
|
|
176
|
+
if (r.includes('not elim') || r.includes('¬e') || r.includes('contradiction')) {
|
|
177
|
+
return 'contradiction';
|
|
178
|
+
}
|
|
179
|
+
if (r.includes('forall intro') || r.includes('∀i')) {
|
|
180
|
+
return 'intro x';
|
|
181
|
+
}
|
|
182
|
+
if (r.includes('forall elim') || r.includes('∀e')) {
|
|
183
|
+
return 'exact h x';
|
|
184
|
+
}
|
|
185
|
+
if (r.includes('exists intro') || r.includes('∃i')) {
|
|
186
|
+
return 'exact ⟨x, hx⟩';
|
|
187
|
+
}
|
|
188
|
+
if (r.includes('exists elim') || r.includes('∃e')) {
|
|
189
|
+
return 'obtain ⟨x, hx⟩ := h';
|
|
190
|
+
}
|
|
191
|
+
if (r.includes('lem') || r.includes('excluded middle') || r.includes('em')) {
|
|
192
|
+
return 'exact Classical.em _';
|
|
193
|
+
}
|
|
194
|
+
if (r.includes('exact') || r === 'goal') {
|
|
195
|
+
return 'exact h';
|
|
196
|
+
}
|
|
197
|
+
if (r.includes('assumption') || r === 'premise') {
|
|
198
|
+
return 'assumption';
|
|
199
|
+
}
|
|
200
|
+
if (r.includes('tauto')) {
|
|
201
|
+
return 'tauto';
|
|
202
|
+
}
|
|
203
|
+
return `sorry -- TODO: ${rule}`;
|
|
204
|
+
}
|
|
205
|
+
// ----------------------------------------------------------------
|
|
206
|
+
// Tactic skeleton derivation from a Proof object
|
|
207
|
+
// ----------------------------------------------------------------
|
|
208
|
+
function proofStepToTactic(step) {
|
|
209
|
+
if (step.source === 'premise' || step.justification.toLowerCase().includes('premise')) {
|
|
210
|
+
return ` -- step ${step.stepNumber}: premise — already in context`;
|
|
211
|
+
}
|
|
212
|
+
if (step.source === 'assumption' || step.justification.toLowerCase().includes('assumption')) {
|
|
213
|
+
return ' assumption';
|
|
214
|
+
}
|
|
215
|
+
return ` ${leanTacticForRule(step.justification)}`;
|
|
216
|
+
}
|
|
217
|
+
function buildTacticBlock(proof) {
|
|
218
|
+
if (proof.status !== 'complete' || proof.steps.length === 0) {
|
|
219
|
+
return ' sorry -- TODO: derive — proof not complete';
|
|
220
|
+
}
|
|
221
|
+
return proof.steps.map(proofStepToTactic).join('\n');
|
|
222
|
+
}
|
|
223
|
+
// ----------------------------------------------------------------
|
|
224
|
+
// Heuristic proofs for common shapes
|
|
225
|
+
// ----------------------------------------------------------------
|
|
226
|
+
/** Detects `P → P` and emits the identity proof. */
|
|
227
|
+
function tryIdentityProof(formula) {
|
|
228
|
+
if (formula.kind !== 'implies')
|
|
229
|
+
return null;
|
|
230
|
+
const ant = formula.args?.[0];
|
|
231
|
+
const con = formula.args?.[1];
|
|
232
|
+
if (!ant || !con)
|
|
233
|
+
return null;
|
|
234
|
+
if (ant.kind === 'atom' && con.kind === 'atom' && ant.name === con.name) {
|
|
235
|
+
return ` intro h\n exact h`;
|
|
236
|
+
}
|
|
237
|
+
return null;
|
|
238
|
+
}
|
|
239
|
+
/** Detects `(A ∧ B) → A` — left projection. */
|
|
240
|
+
function tryAndElimLeftProof(formula) {
|
|
241
|
+
if (formula.kind !== 'implies')
|
|
242
|
+
return null;
|
|
243
|
+
const ant = formula.args?.[0];
|
|
244
|
+
const con = formula.args?.[1];
|
|
245
|
+
if (!ant || !con)
|
|
246
|
+
return null;
|
|
247
|
+
if (ant.kind === 'and' && con.kind === 'atom') {
|
|
248
|
+
const leftArg = ant.args?.[0];
|
|
249
|
+
if (leftArg?.kind === 'atom' && leftArg.name === con.name) {
|
|
250
|
+
return ` intro h\n exact h.left`;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
return null;
|
|
254
|
+
}
|
|
255
|
+
/** Detects `(A ∧ B) → B` — right projection. */
|
|
256
|
+
function tryAndElimRightProof(formula) {
|
|
257
|
+
if (formula.kind !== 'implies')
|
|
258
|
+
return null;
|
|
259
|
+
const ant = formula.args?.[0];
|
|
260
|
+
const con = formula.args?.[1];
|
|
261
|
+
if (!ant || !con)
|
|
262
|
+
return null;
|
|
263
|
+
if (ant.kind === 'and' && con.kind === 'atom') {
|
|
264
|
+
const rightArg = ant.args?.[1];
|
|
265
|
+
if (rightArg?.kind === 'atom' && rightArg.name === con.name) {
|
|
266
|
+
return ` intro h\n exact h.right`;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
return null;
|
|
270
|
+
}
|
|
271
|
+
/** Detects `P ∨ ¬P` (LEM). */
|
|
272
|
+
function tryLEMProof(formula) {
|
|
273
|
+
if (formula.kind !== 'or')
|
|
274
|
+
return null;
|
|
275
|
+
const left = formula.args?.[0];
|
|
276
|
+
const right = formula.args?.[1];
|
|
277
|
+
if (!left || !right)
|
|
278
|
+
return null;
|
|
279
|
+
if (left.kind === 'atom' && right.kind === 'not') {
|
|
280
|
+
const negArg = right.args?.[0];
|
|
281
|
+
if (negArg?.kind === 'atom' && negArg.name === left.name) {
|
|
282
|
+
return ` exact Classical.em _`;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
if (right.kind === 'atom' && left.kind === 'not') {
|
|
286
|
+
const negArg = left.args?.[0];
|
|
287
|
+
if (negArg?.kind === 'atom' && negArg.name === right.name) {
|
|
288
|
+
return ` exact (Classical.em _).symm`;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
return null;
|
|
292
|
+
}
|
|
293
|
+
/** Picks the best tactic skeleton given just a goal formula. */
|
|
294
|
+
function heuristicTactics(formula) {
|
|
295
|
+
const identity = tryIdentityProof(formula);
|
|
296
|
+
if (identity)
|
|
297
|
+
return identity;
|
|
298
|
+
const lem = tryLEMProof(formula);
|
|
299
|
+
if (lem)
|
|
300
|
+
return lem;
|
|
301
|
+
const andLeft = tryAndElimLeftProof(formula);
|
|
302
|
+
if (andLeft)
|
|
303
|
+
return andLeft;
|
|
304
|
+
const andRight = tryAndElimRightProof(formula);
|
|
305
|
+
if (andRight)
|
|
306
|
+
return andRight;
|
|
307
|
+
if (formula.kind === 'forall') {
|
|
308
|
+
const body = formula.args?.[0];
|
|
309
|
+
if (body?.kind === 'implies') {
|
|
310
|
+
const ant = body.args?.[0];
|
|
311
|
+
const con = body.args?.[1];
|
|
312
|
+
if (ant?.kind === 'predicate' && con?.kind === 'exists') {
|
|
313
|
+
const exVar = con.variable ?? 'y';
|
|
314
|
+
// Lean 4: provide the witness and reuse the assumption.
|
|
315
|
+
return ` intro x\n intro h\n exact ⟨${exVar}, h⟩`;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
return ` intro ${formula.variable ?? 'x'}\n sorry -- TODO: derive`;
|
|
319
|
+
}
|
|
320
|
+
return ` sorry -- TODO: derive`;
|
|
321
|
+
}
|
|
322
|
+
// ----------------------------------------------------------------
|
|
323
|
+
// Import / header helpers
|
|
324
|
+
// ----------------------------------------------------------------
|
|
325
|
+
function resolveImports(opts) {
|
|
326
|
+
if (opts?.imports !== undefined)
|
|
327
|
+
return opts.imports;
|
|
328
|
+
const useMathlib = opts?.useMathlib ?? true;
|
|
329
|
+
return useMathlib ? exports.COMMON_IMPORTS.mathlib : exports.COMMON_IMPORTS.minimal;
|
|
330
|
+
}
|
|
331
|
+
function emitImports(imports) {
|
|
332
|
+
return imports.filter((i) => i.length > 0).map((i) => `import ${i}`);
|
|
333
|
+
}
|
|
334
|
+
// ----------------------------------------------------------------
|
|
335
|
+
// Main export functions
|
|
336
|
+
// ----------------------------------------------------------------
|
|
337
|
+
/**
|
|
338
|
+
* Exports a single ST Formula as a Lean 4 module containing a
|
|
339
|
+
* `def stmt : Prop := ...` and an optional `theorem stmt_proof : stmt := by ...`.
|
|
340
|
+
*/
|
|
341
|
+
function exportToLean4(formula, opts) {
|
|
342
|
+
const moduleName = opts?.moduleName ?? 'STExport';
|
|
343
|
+
const emitProof = opts?.emitProof ?? true;
|
|
344
|
+
const imports = resolveImports(opts);
|
|
345
|
+
const term = formulaToLeanTerm(formula);
|
|
346
|
+
const lines = [];
|
|
347
|
+
const importLines = emitImports(imports);
|
|
348
|
+
if (importLines.length > 0) {
|
|
349
|
+
lines.push(...importLines);
|
|
350
|
+
lines.push('');
|
|
351
|
+
}
|
|
352
|
+
lines.push(`namespace ${moduleName}`);
|
|
353
|
+
lines.push('');
|
|
354
|
+
lines.push(`def stmt : Prop := ${term}`);
|
|
355
|
+
if (emitProof) {
|
|
356
|
+
lines.push('');
|
|
357
|
+
lines.push(`theorem stmt_proof : stmt := by`);
|
|
358
|
+
lines.push(heuristicTactics(formula));
|
|
359
|
+
}
|
|
360
|
+
lines.push('');
|
|
361
|
+
lines.push(`end ${moduleName}`);
|
|
362
|
+
return lines.join('\n');
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* Exports an ST Proof object as a Lean 4 module whose theorem body is
|
|
366
|
+
* derived from the proof steps.
|
|
367
|
+
*/
|
|
368
|
+
function exportProofToLean4(proof, opts) {
|
|
369
|
+
const moduleName = opts?.moduleName ?? 'STExport';
|
|
370
|
+
const emitProof = opts?.emitProof ?? true;
|
|
371
|
+
const imports = resolveImports(opts);
|
|
372
|
+
const term = formulaToLeanTerm(proof.goal);
|
|
373
|
+
const lines = [];
|
|
374
|
+
const importLines = emitImports(imports);
|
|
375
|
+
if (importLines.length > 0) {
|
|
376
|
+
lines.push(...importLines);
|
|
377
|
+
lines.push('');
|
|
378
|
+
}
|
|
379
|
+
lines.push(`namespace ${moduleName}`);
|
|
380
|
+
lines.push('');
|
|
381
|
+
lines.push(`def stmt : Prop := ${term}`);
|
|
382
|
+
if (emitProof) {
|
|
383
|
+
lines.push('');
|
|
384
|
+
lines.push(`theorem stmt_proof : stmt := by`);
|
|
385
|
+
lines.push(buildTacticBlock(proof));
|
|
386
|
+
}
|
|
387
|
+
lines.push('');
|
|
388
|
+
lines.push(`end ${moduleName}`);
|
|
389
|
+
return lines.join('\n');
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Exports a small theory (axioms + theorems) as a single Lean 4 module.
|
|
393
|
+
* Axioms become `axiom ax_i : <prop>` declarations; theorems become
|
|
394
|
+
* `theorem th_i : <prop> := by sorry` skeletons that the user fills in.
|
|
395
|
+
*/
|
|
396
|
+
function exportTheoryToLean4(axioms, theorems, opts) {
|
|
397
|
+
const moduleName = opts?.moduleName ?? 'STExport';
|
|
398
|
+
const emitProof = opts?.emitProof ?? true;
|
|
399
|
+
const imports = resolveImports(opts);
|
|
400
|
+
const lines = [];
|
|
401
|
+
const importLines = emitImports(imports);
|
|
402
|
+
if (importLines.length > 0) {
|
|
403
|
+
lines.push(...importLines);
|
|
404
|
+
lines.push('');
|
|
405
|
+
}
|
|
406
|
+
lines.push(`namespace ${moduleName}`);
|
|
407
|
+
axioms.forEach((ax, idx) => {
|
|
408
|
+
lines.push('');
|
|
409
|
+
lines.push(`axiom ax_${idx + 1} : ${formulaToLeanTerm(ax)}`);
|
|
410
|
+
});
|
|
411
|
+
theorems.forEach((th, idx) => {
|
|
412
|
+
lines.push('');
|
|
413
|
+
lines.push(`def stmt_${idx + 1} : Prop := ${formulaToLeanTerm(th)}`);
|
|
414
|
+
if (emitProof) {
|
|
415
|
+
lines.push(`theorem stmt_${idx + 1}_proof : stmt_${idx + 1} := by`);
|
|
416
|
+
lines.push(heuristicTactics(th));
|
|
417
|
+
}
|
|
418
|
+
});
|
|
419
|
+
lines.push('');
|
|
420
|
+
lines.push(`end ${moduleName}`);
|
|
421
|
+
return lines.join('\n');
|
|
422
|
+
}
|
|
423
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/tooling/exporters/lean4/index.ts"],"names":[],"mappings":";AAAA,+DAA+D;AAC/D,2DAA2D;AAC3D,+DAA+D;AAC/D,8DAA8D;AAC9D,6CAA6C;AAC7C,6DAA6D;AAC7D,qEAAqE;AACrE,sEAAsE;AACtE,+DAA+D;AAC/D,+DAA+D;AAC/D,mEAAmE;AACnE,+DAA+D;;;AA8D/D,8CAsEC;AAuBD,8CA8DC;AA+ID,sCA4BC;AAMD,gDA4BC;AAOD,kDAoCC;AA9bD,mEAAmE;AACnE,yBAAyB;AACzB,mEAAmE;AAEtD,QAAA,cAAc,GAAyD;IAClF,4C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CAAC,IAAI,CAAC,OAAO,UAAU,EAAE,CAAC,CAAC;IAEhC,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stevenvo780/st-lang",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.10.0",
|
|
4
4
|
"description": "ST — Lenguaje ejecutable con nucleo logico y capa textual. Motor multi-perfil (11 lógicas), derivaciones, tablas de verdad, contramodelos, aliases modales, Belnap 4-valores y capa textual para formalización de documentos.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|