-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStr2Term.lean
More file actions
28 lines (24 loc) · 831 Bytes
/
Copy pathStr2Term.lean
File metadata and controls
28 lines (24 loc) · 831 Bytes
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
import Lean
open Lean Elab Term
def hello := "world"
def sss := "∀a b, a → b → a ∧ b"
elab "myt[" s:str "]" : term => do
logInfo s!"{s}"
pure $ mkStrLit "a"
#eval myt["nakami"]
elab "myterm[" s:str "]" : term => do
let env ← getEnv
let _a ← (pure:_ → IO _) "a"
let aa := s.getString
logInfo s!"ho:{aa}"
let parsedSyntax ← match Lean.Parser.runParserCategory env `term s.getString with
| Except.ok stx => pure stx
| Except.error errmsg => throwError errmsg
logInfo s!"{parsedSyntax}"
let prop ← elabTerm parsedSyntax none-- (mkConst `Lean.Prop)
logInfo s!"hi:{prop}"
pure prop
theorem propStr : myterm["∀a b, a → b → a ∧ b"] :=
fun {a b : Prop} (ha : a) (hb : b) => ⟨ha,hb⟩
def p := myterm["∀a b, a → b → a ∧ b"]
#print p