Skip to content

Commit 5788d22

Browse files
committed
chore: display E-matching theorems in goalToMessageData
This PR includes the activated E-matching theorems and their patterns in `goalToMessageData`
1 parent f57745e commit 5788d22

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/Lean/Meta/Tactic/Grind/PP.lean

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,23 @@ private def ppEqcs (goal : Goal) : MetaM (Array MessageData) := do
9999
result := result.push <| .trace { cls := `eqc } "Equivalence classes" otherEqcs
100100
return result
101101

102+
private def ppEMatchTheorem (thm : EMatchTheorem) : MetaM MessageData := do
103+
let m := m!"{← thm.origin.pp}\n{← inferType thm.proof}\npatterns: {thm.patterns.map ppPattern}"
104+
return .trace { cls := `thm } m #[]
105+
106+
private def ppActiveTheorems (goal : Goal) : MetaM MessageData := do
107+
let m ← goal.thms.toArray.mapM ppEMatchTheorem
108+
let m := m ++ (← goal.newThms.toArray.mapM ppEMatchTheorem)
109+
if m.isEmpty then
110+
return ""
111+
else
112+
return .trace { cls := `ematch } "E-matching" m
113+
102114
def goalToMessageData (goal : Goal) : MetaM MessageData := goal.mvarId.withContext do
103115
let mut m : Array MessageData := #[.ofGoal goal.mvarId]
104116
m := m.push <| ppExprArray `facts "Asserted facts" goal.facts.toArray `prop
105117
m := m ++ (← ppEqcs goal)
118+
m := m.push (← ppActiveTheorems goal)
106119
addMessageContextFull <| MessageData.joinSep m.toList ""
107120

108121
def goalsToMessageData (goals : List Goal) : MetaM MessageData :=

0 commit comments

Comments
 (0)