feat: Condensed interface #85
|
@ -63,9 +63,16 @@ protected def GoalState.mctx (state: GoalState): MetavarContext :=
|
||||||
protected def GoalState.env (state: GoalState): Environment :=
|
protected def GoalState.env (state: GoalState): Environment :=
|
||||||
state.savedState.term.meta.core.env
|
state.savedState.term.meta.core.env
|
||||||
|
|
||||||
|
@[export pantograph_goal_state_meta_context_of_goal]
|
||||||
|
protected def GoalState.metaContextOfGoal (state: GoalState) (mvarId: MVarId): Option Meta.Context := do
|
||||||
|
let mvarDecl ← state.mctx.findDecl? mvarId
|
||||||
|
return { lctx := mvarDecl.lctx, localInstances := mvarDecl.localInstances }
|
||||||
|
@[export pantograph_goal_state_meta_state]
|
||||||
|
protected def GoalState.metaState (state: GoalState): Meta.State :=
|
||||||
|
state.savedState.term.meta.meta
|
||||||
|
|
||||||
protected def GoalState.withContext (state: GoalState) (mvarId: MVarId) (m: MetaM α): MetaM α := do
|
protected def GoalState.withContext (state: GoalState) (mvarId: MVarId) (m: MetaM α): MetaM α := do
|
||||||
let metaM := mvarId.withContext m
|
mvarId.withContext m |>.run' (← read) state.metaState
|
||||||
metaM.run' (← read) state.savedState.term.meta.meta
|
|
||||||
|
|
||||||
protected def GoalState.withParentContext (state: GoalState) (m: MetaM α): MetaM α := do
|
protected def GoalState.withParentContext (state: GoalState) (m: MetaM α): MetaM α := do
|
||||||
state.withContext state.parentMVar?.get! m
|
state.withContext state.parentMVar?.get! m
|
||||||
|
@ -82,6 +89,7 @@ private def GoalState.restoreTacticM (state: GoalState) (goal: MVarId): Elab.Tac
|
||||||
state.savedState.restore
|
state.savedState.restore
|
||||||
Elab.Tactic.setGoals [goal]
|
Elab.Tactic.setGoals [goal]
|
||||||
|
|
||||||
|
|
||||||
private def newMVarSet (mctxOld: @&MetavarContext) (mctxNew: @&MetavarContext): SSet MVarId :=
|
private def newMVarSet (mctxOld: @&MetavarContext) (mctxNew: @&MetavarContext): SSet MVarId :=
|
||||||
mctxNew.decls.foldl (fun acc mvarId mvarDecl =>
|
mctxNew.decls.foldl (fun acc mvarId mvarDecl =>
|
||||||
if let .some prevMVarDecl := mctxOld.decls.find? mvarId then
|
if let .some prevMVarDecl := mctxOld.decls.find? mvarId then
|
||||||
|
|
Loading…
Reference in New Issue