fix: Instantiation causes infinite loop

This commit is contained in:
Leni Aniva 2024-03-30 00:17:16 -07:00
parent 0c260addcf
commit e13b119ed1
Signed by: aniva
GPG Key ID: 4D9B1C8D10EA4C50
2 changed files with 3 additions and 7 deletions

View File

@ -127,7 +127,7 @@ def exprEcho (expr: String) (options: @&Protocol.Options):
| .error e => return .error e
| .ok expr => pure expr
try
let type ← instantiateAll (← Lean.Meta.inferType expr)
let type ← unfoldAuxLemmas (← Lean.Meta.inferType expr)
return .ok {
type := (← serialize_expression options type),
expr := (← serialize_expression options expr)
@ -171,9 +171,9 @@ def goalPrint (state: GoalState) (options: @&Protocol.Options): Lean.CoreM Proto
state.restoreMetaM
return {
root? := ← state.rootExpr?.mapM (λ expr => do
serialize_expression options (← instantiateAll expr)),
serialize_expression options (← unfoldAuxLemmas expr)),
parent? := ← state.parentExpr?.mapM (λ expr => do
serialize_expression options (← instantiateAll expr)),
serialize_expression options (← unfoldAuxLemmas expr)),
}
runMetaM metaM

View File

@ -18,10 +18,6 @@ namespace Pantograph
def unfoldAuxLemmas (e : Lean.Expr) : Lean.MetaM Lean.Expr := do
Lean.Meta.deltaExpand e Lean.Name.isAuxLemma
def instantiateAll (e: Lean.Expr) : Lean.MetaM Lean.Expr := do
let e ← unfoldAuxLemmas e
instantiateMVars (← Lean.Meta.whnf e)
--- Input Functions ---
/-- Read syntax object from string -/