@@ -95,15 +95,15 @@ def recordProofSnapshot (proofState : ProofSnapshot) : M m Nat := do
95
95
modify fun s => { s with proofStates := s.proofStates.push proofState }
96
96
return id
97
97
98
- def sorries (trees : List InfoTree) : M m (List Sorry) :=
98
+ def sorries (trees : List InfoTree) (env? : Option Environment) : M m (List Sorry) :=
99
99
trees.bind InfoTree.sorries |>.mapM
100
100
fun ⟨ctx, g, pos, endPos⟩ => do
101
101
let (goal, proofState) ← match g with
102
102
| .tactic g => do
103
- let s ← ProofSnapshot.create ctx none [g]
103
+ let s ← ProofSnapshot.create ctx none env? [g]
104
104
pure ("\n " .intercalate <| (← s.ppGoals).map fun s => s! "{ s} " , some s)
105
105
| .term lctx (some t) => do
106
- let s ← ProofSnapshot.create ctx lctx [] [t]
106
+ let s ← ProofSnapshot.create ctx lctx env? [] [t]
107
107
pure ("\n " .intercalate <| (← s.ppGoals).map fun s => s! "{ s} " , some s)
108
108
| .term _ none => unreachable!
109
109
let proofStateId ← proofState.mapM recordProofSnapshot
@@ -118,7 +118,7 @@ def ppTactic (ctx : ContextInfo) (stx : Syntax) : IO Format :=
118
118
def tactics (trees : List InfoTree) : M m (List Tactic) :=
119
119
trees.bind InfoTree.tactics |>.mapM
120
120
fun ⟨ctx, stx, goals, pos, endPos⟩ => do
121
- let proofState := some (← ProofSnapshot.create ctx none goals)
121
+ let proofState := some (← ProofSnapshot.create ctx none none goals)
122
122
let goals := s! "{ (← ctx.ppGoals goals)} " .trim
123
123
let tactic := Format.pretty (← ppTactic ctx stx)
124
124
let proofStateId ← proofState.mapM recordProofSnapshot
@@ -139,7 +139,7 @@ def createProofStepReponse (proofState : ProofSnapshot) (old? : Option ProofSnap
139
139
| none => pure trees
140
140
-- For debugging purposes, sometimes we print out the trees here:
141
141
-- trees.forM fun t => do IO.println (← t.format)
142
- let sorries ← sorries trees
142
+ let sorries ← sorries trees none
143
143
let id ← recordProofSnapshot proofState
144
144
return {
145
145
proofState := id
@@ -194,15 +194,15 @@ def runCommand (s : Command) : M IO (CommandResponse ⊕ Error) := do
194
194
| none => pure (none, true )
195
195
if notFound then
196
196
return .inr ⟨"Unknown environment." ⟩
197
- let cmdState ? := cmdSnapshot?.map fun c => c.cmdState
197
+ let initialCmdState ? := cmdSnapshot?.map fun c => c.cmdState
198
198
let (cmdState, messages, trees) ← try
199
- IO.processInput s.cmd cmdState ?
199
+ IO.processInput s.cmd initialCmdState ?
200
200
catch ex =>
201
201
return .inr ⟨ex.toString⟩
202
202
let messages ← messages.mapM fun m => Message.of m
203
203
-- For debugging purposes, sometimes we print out the trees here:
204
204
-- trees.forM fun t => do IO.println (← t.format)
205
- let sorries ← sorries trees
205
+ let sorries ← sorries trees (initialCmdState?.map (·.env))
206
206
let tactics ← match s.allTactics with
207
207
| some true => tactics trees
208
208
| _ => pure []
0 commit comments