Skip to content

Commit 8d8e553

Browse files
committed
Add more forward debug tracing
1 parent de4687f commit 8d8e553

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

Aesop/Forward/State.lean

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ def modify (vmap : VariableMap) (var : PremiseIndex) (f : InstMap → InstMap ×
267267
for each variable in `slot.common`). Returns `true` if the variable map
268268
changed. -/
269269
def addHyp (vmap : VariableMap) (slot : Slot) (hyp : Hyp) : BaseM (VariableMap × Bool) :=
270+
withAesopTraceNode .forwardDebug (fun _ => return m!"VariableMap.addHyp {slot.index}") do
270271
slot.common.foldM (init := (vmap, false)) λ (vmap, changed) var => do
271272
if let some inst := hyp.subst.find? var then
272273
let (vmap, changed') ← vmap.modifyM var (·.insertHyp slot.index inst hyp)
@@ -278,6 +279,7 @@ def addHyp (vmap : VariableMap) (slot : Slot) (hyp : Hyp) : BaseM (VariableMap
278279
`m.level + 1`. Returns `true` if the variable map changed. -/
279280
def addMatch (vmap : VariableMap) (nextSlot : Slot) (m : Match) :
280281
BaseM (VariableMap × Bool) :=
282+
withAesopTraceNode .forwardDebug (fun _ => return m!"VariableMap.addMatch {nextSlot.index.toNat - 1}") do
281283
nextSlot.common.foldM (init := (vmap, false)) λ (vmap, changed) var => do
282284
let (vmap, changed') ← vmap.modifyM var (·.insertMatch var m)
283285
return (vmap, changed || changed')
@@ -297,6 +299,7 @@ def erasePatSubst (vmap : VariableMap) (subst : Substitution) (slot : SlotIndex)
297299
each variable contained in `slot.common` is also contained in `subst`. -/
298300
def findMatches (vmap : VariableMap) (slot : Slot) (subst : Substitution) :
299301
BaseM (Std.HashSet Match) := do
302+
withAesopTraceNode .forwardDebug (fun _ => return m!"VariableMap.findMatches {slot.index}") do
300303
if slot.index == ⟨0then
301304
panic! "slot has index 0"
302305
let common := slot.common.toArray
@@ -323,6 +326,7 @@ Precondition: `slot.common` is nonempty and each variable contained in it is
323326
also contained in `subst`. -/
324327
def findHyps (vmap : VariableMap) (slot : Slot) (subst : Substitution) :
325328
BaseM (Std.HashSet Hyp) := do
329+
withAesopTraceNode .forwardDebug (fun _ => return m!"VariableMap.findHyps {slot.index}") do
326330
let common := slot.common.toArray
327331
if h : 0 < common.size then
328332
let mut hyps := PersistentHashSet.toHashSet (← slotHyps common[0])

Aesop/Util/Basic.lean

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,8 @@ scoped instance [MonadParentDecl m] : MonadParentDecl (ReaderT ρ m) where
565565
scoped instance [MonadParentDecl m] : MonadParentDecl (StateRefT' ω σ m) where
566566
getParentDeclName? := liftM (m := m) getParentDeclName?
567567

568-
def isDefEqReducibleRigid (s t : Expr) : MetaM Bool := do
568+
def isDefEqReducibleRigid (s t : Expr) : MetaM Bool :=
569+
withTraceNodeBefore `aesop.forward.debug (return m!"{s} ≟ {t}") do
569570
withNewMCtxDepth do
570571
withReducible do
571572
isDefEq s t

0 commit comments

Comments
 (0)