@bramas/simulant-lean-gen 0.1.1 → 0.1.2

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.
Files changed (2) hide show
  1. package/README.md +51 -0
  2. package/package.json +3 -3
package/README.md ADDED
@@ -0,0 +1,51 @@
1
+ # @bramas/simulant-lean-gen
2
+
3
+ Translate compiled Simulant experiments to Lean 4. The generator emits the
4
+ composed model, algorithm, initial configurations, parameter domains, task and
5
+ statements to prove, using the semantic library in `@bramas/simulant-lean`.
6
+
7
+ ## Generate from a project
8
+
9
+ The CLI manages output files, the Lean toolchain and library dependencies:
10
+
11
+ ```sh
12
+ npx simulant lean
13
+ npx simulant lean --build
14
+ ```
15
+
16
+ Run these commands in a Simulant project. Use `-p <simulation>` when several
17
+ simulations are registered. Install elan separately to compile the Lean output.
18
+ Generated files live under `lean/Generated/`; hand-written proofs belong in
19
+ `lean/Proofs/` and are preserved on regeneration.
20
+
21
+ ## Generator API
22
+
23
+ ```sh
24
+ npm install @bramas/simulant-lean-gen @bramas/simulant-lang
25
+ ```
26
+
27
+ ```ts
28
+ import { loadProgram } from '@bramas/simulant-lang/elab/node';
29
+ import { compile } from '@bramas/simulant-lang/elab/elaborate';
30
+ import { generateModel } from '@bramas/simulant-lean-gen/model';
31
+
32
+ const compiled = compile(loadProgram('src/main.sim'));
33
+ const experiment = compiled.experiments.cautiousPair?.experiment;
34
+ if (!experiment) throw new Error('Check the compiler diagnostics');
35
+
36
+ const lean = generateModel(experiment, 'Generated.CautiousPair');
37
+ console.log(lean);
38
+ ```
39
+
40
+ `generateMappedModel` also returns source-region metadata for the simulator's
41
+ Lean viewer. Other subpaths expose component translation, library generation,
42
+ proof checks and interpreter/Lean differential checks. There is no root import.
43
+
44
+ Generating or compiling a model does not prove its correctness statement.
45
+ The generator supports a documented subset of the IR and rejects unsupported
46
+ constructs rather than silently weakening the model.
47
+
48
+ [Lean guarantees and limits](https://github.com/Bramas/simulant/blob/main/docs/architecture.md#lean-guarantees-and-limits)
49
+ · [Source](https://github.com/Bramas/simulant/tree/main/packages/lean-gen)
50
+
51
+ Licensed under CeCILL-B; see `LICENCE.txt`.
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@bramas/simulant-lean-gen",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "private": false,
5
5
  "license": "CECILL-B",
6
6
  "type": "module",
7
7
  "dependencies": {
8
- "@bramas/simulant-lang": "0.1.1",
9
- "@bramas/simulant-engine": "0.1.1"
8
+ "@bramas/simulant-lang": "0.1.2",
9
+ "@bramas/simulant-engine": "0.1.2"
10
10
  },
11
11
  "exports": {
12
12
  "./check-proofs": {