Skip to content

Commit b0daa99

Browse files
committed
fix: ground theorems as grind parameters
This PR ensures that ground theorems are properly handled as `grind` parameters. Additionally, `grind [(thm)]` and `grind [thm]` should be handled the same way.
1 parent 19e1fe5 commit b0daa99

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

src/Lean/Elab/Tactic/Grind/Param.lean

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,21 @@ public def addEMatchTheorem (params : Grind.Params) (id : Ident) (declName : Nam
6767
Grind.mkEMatchTheoremForDecl declName kind params.symPrios (minIndexable := minIndexable)
6868
if warn && params.ematch.containsWithSamePatterns thm.origin thm.patterns thm.cnstrs then
6969
warnRedundantEMatchArg params.ematch declName
70-
return { params with extra := params.extra.push thm }
70+
if thm.numParams == 0 && kind matches .default _ then
71+
/-
72+
**Note**: ignores pattern and adds ground fact directly
73+
Motivation:
74+
```
75+
opaque π : Rat
76+
axiom pi_pos : 0 < π
77+
example : π = 0 → False := by
78+
grind [pi_pos]
79+
80+
```
81+
-/
82+
return { params with extraFacts := params.extraFacts.push thm.proof }
83+
else
84+
return { params with extra := params.extra.push thm }
7185
| .defn =>
7286
if (← isReducible declName) then
7387
throwError "`{.ofConstName declName}` is a reducible definition, `grind` automatically unfolds them"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
opaque π : Rat
2+
axiom pi_pos : 0 < π
3+
4+
example : π = 0 → False := by
5+
grind [pi_pos]
6+
7+
example : 0 < 2 * π := by
8+
grind [pi_pos]

0 commit comments

Comments
 (0)