forked from siddhartha-gadgil/LeanAide
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchkelab.lean
33 lines (30 loc) · 974 Bytes
/
chkelab.lean
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import Lean.Meta
import LeanCodePrompts
import LeanCodePrompts.BatchTranslate
import LeanAide.Config
open Lean
set_option maxHeartbeats 10000000
set_option maxRecDepth 1000
set_option compiler.extract_closed false
def main (args: List String) : IO Unit := do
initSearchPath (← Lean.findSysroot) initFiles
let completions := (args.getD 0 "thm")
let env ←
importModules #[{module := `Mathlib},
{module:= `LeanAide.TheoremElab},
{module:= `LeanCodePrompts.Translate},
{module := `Mathlib}] {}
let core :=
outputFromCompletionsCore completions
let io? :=
core.run' {fileName := "", fileMap := {source:= "", positions := #[]}, maxHeartbeats := 100000000000, maxRecDepth := 1000000}
{env := env}
match ← io?.toIO' with
| Except.ok js =>
IO.println js
| Except.error e =>
do
let msg ← e.toMessageData.toString
let js := Json.mkObj [("error", Json.str msg)]
IO.println <| js.pretty 100000
return ()