feat: Prograde tactics #83
|
@ -52,7 +52,7 @@ def processOneCommand: Elab.Frontend.FrontendM (CompilationStep × Bool) := do
|
||||||
let src := (← read).inputCtx.input.toSubstring.extract (← get).cmdPos (← get).parserState.pos
|
let src := (← read).inputCtx.input.toSubstring.extract (← get).cmdPos (← get).parserState.pos
|
||||||
let s' := (← get).commandState
|
let s' := (← get).commandState
|
||||||
let after := s'.env
|
let after := s'.env
|
||||||
let msgs := s'.messages.msgs.drop s.messages.msgs.size
|
let msgs := s'.messages.toList.drop s.messages.toList.length
|
||||||
let trees := s'.infoState.trees.drop s.infoState.trees.size
|
let trees := s'.infoState.trees.drop s.infoState.trees.size
|
||||||
let ⟨_, fileName, fileMap⟩ := (← read).inputCtx
|
let ⟨_, fileName, fileMap⟩ := (← read).inputCtx
|
||||||
return ({ fileName, fileMap, src, stx, before, after, msgs, trees }, done)
|
return ({ fileName, fileMap, src, stx, before, after, msgs, trees }, done)
|
||||||
|
|
|
@ -132,7 +132,7 @@ def addDecl (args: Protocol.EnvAdd): CoreM (Protocol.CR Protocol.EnvAddResult) :
|
||||||
(hints := Lean.mkReducibilityHintsRegularEx 1)
|
(hints := Lean.mkReducibilityHintsRegularEx 1)
|
||||||
(safety := Lean.DefinitionSafety.safe)
|
(safety := Lean.DefinitionSafety.safe)
|
||||||
(all := [])
|
(all := [])
|
||||||
let env' ← match env.addDecl constant with
|
let env' ← match env.addDecl (← getOptions) constant with
|
||||||
| .error e => do
|
| .error e => do
|
||||||
let options ← Lean.MonadOptions.getOptions
|
let options ← Lean.MonadOptions.getOptions
|
||||||
let desc ← (e.toMessageData options).toString
|
let desc ← (e.toMessageData options).toString
|
||||||
|
|
|
@ -8,11 +8,6 @@ import Pantograph.Tactic
|
||||||
import Pantograph.Compile.Parse
|
import Pantograph.Compile.Parse
|
||||||
import Lean
|
import Lean
|
||||||
|
|
||||||
def Lean.MessageLog.getErrorMessages (log : MessageLog) : MessageLog :=
|
|
||||||
{
|
|
||||||
msgs := log.msgs.filter fun m => match m.severity with | MessageSeverity.error => true | _ => false
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
namespace Pantograph
|
namespace Pantograph
|
||||||
open Lean
|
open Lean
|
||||||
|
@ -187,7 +182,7 @@ protected def GoalState.execute (state: GoalState) (goalId: Nat) (tacticM: Elab.
|
||||||
try
|
try
|
||||||
let (_, newGoals) ← tacticM { elaborator := .anonymous } |>.run { goals := [goal] }
|
let (_, newGoals) ← tacticM { elaborator := .anonymous } |>.run { goals := [goal] }
|
||||||
if (← getThe Core.State).messages.hasErrors then
|
if (← getThe Core.State).messages.hasErrors then
|
||||||
let messages := (← getThe Core.State).messages.getErrorMessages |>.toList.toArray
|
let messages := (← getThe Core.State).messages.toArray
|
||||||
let errors ← (messages.map (·.data)).mapM fun md => md.toString
|
let errors ← (messages.map (·.data)).mapM fun md => md.toString
|
||||||
return .failure errors
|
return .failure errors
|
||||||
let nextElabState ← MonadBacktrack.saveState
|
let nextElabState ← MonadBacktrack.saveState
|
||||||
|
@ -232,7 +227,7 @@ protected def GoalState.assign (state: GoalState) (goal: MVarId) (expr: Expr):
|
||||||
goal.checkNotAssigned `GoalState.assign
|
goal.checkNotAssigned `GoalState.assign
|
||||||
goal.assign expr
|
goal.assign expr
|
||||||
if (← getThe Core.State).messages.hasErrors then
|
if (← getThe Core.State).messages.hasErrors then
|
||||||
let messages := (← getThe Core.State).messages.getErrorMessages |>.toList.toArray
|
let messages := (← getThe Core.State).messages.toArray
|
||||||
let errors ← (messages.map (·.data)).mapM fun md => md.toString
|
let errors ← (messages.map (·.data)).mapM fun md => md.toString
|
||||||
return .failure errors
|
return .failure errors
|
||||||
let prevMCtx := state.savedState.term.meta.meta.mctx
|
let prevMCtx := state.savedState.term.meta.meta.mctx
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
namespace Pantograph
|
namespace Pantograph
|
||||||
|
|
||||||
@[export pantograph_version]
|
@[export pantograph_version]
|
||||||
def version := "0.2.16"
|
def version := "0.2.17"
|
||||||
|
|
||||||
end Pantograph
|
end Pantograph
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
flake-parts.url = "github:hercules-ci/flake-parts";
|
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||||
lean = {
|
lean = {
|
||||||
# Do not follow input's nixpkgs since it could cause build failures
|
# Do not follow input's nixpkgs since it could cause build failures
|
||||||
url = "github:leanprover/lean4?ref=v4.8.0-rc1";
|
url = "github:leanprover/lean4?ref=v4.10.0-rc1";
|
||||||
};
|
};
|
||||||
lspec = {
|
lspec = {
|
||||||
url = "github:lurk-lab/LSpec?ref=3388be5a1d1390594a74ec469fd54a5d84ff6114";
|
url = "github:lurk-lab/LSpec?ref=3388be5a1d1390594a74ec469fd54a5d84ff6114";
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
leanprover/lean4:v4.8.0-rc1
|
leanprover/lean4:v4.10.0-rc1
|
||||||
|
|
Loading…
Reference in New Issue