@@ -185,7 +185,8 @@ where
185185 -- If it is an inductive predicate,
186186 -- we also add the constructors (intro rules) as E-matching rules
187187 for ctor in info.ctors do
188- params ← withRef p <| addEMatchTheorem params id ctor (.default false ) minIndexable
188+ -- **Note** : We should not warn if `declName` is an inductive
189+ params ← withRef p <| addEMatchTheorem params id ctor (.default false ) minIndexable (warn := False)
189190 else
190191 params ← withRef p <| addEMatchTheorem params id declName (.default false ) minIndexable (suggest := true )
191192 | .symbol prio =>
@@ -195,7 +196,7 @@ where
195196
196197 addEMatchTheorem (params : Grind.Params) (id : Ident) (declName : Name)
197198 (kind : Grind.EMatchTheoremKind)
198- (minIndexable : Bool) (suggest : Bool := false ) : MetaM Grind.Params := do
199+ (minIndexable : Bool) (suggest : Bool := false ) (warn := true ) : MetaM Grind.Params := do
199200 let info ← getAsyncConstInfo declName
200201 match info.kind with
201202 | .thm | .axiom | .ctor =>
@@ -204,7 +205,8 @@ where
204205 ensureNoMinIndexable minIndexable
205206 let thm₁ ← Grind.mkEMatchTheoremForDecl declName (.eqLhs gen) params.symPrios
206207 let thm₂ ← Grind.mkEMatchTheoremForDecl declName (.eqRhs gen) params.symPrios
207- if params.ematch.containsWithSamePatterns thm₁.origin thm₁.patterns &&
208+ if warn &&
209+ params.ematch.containsWithSamePatterns thm₁.origin thm₁.patterns &&
208210 params.ematch.containsWithSamePatterns thm₂.origin thm₂.patterns then
209211 warnRedundantEMatchArg params.ematch declName
210212 return { params with extra := params.extra.push thm₁ |>.push thm₂ }
@@ -215,7 +217,7 @@ where
215217 Grind.mkEMatchTheoremAndSuggest id declName params.symPrios minIndexable (isParam := true )
216218 else
217219 Grind.mkEMatchTheoremForDecl declName kind params.symPrios (minIndexable := minIndexable)
218- if params.ematch.containsWithSamePatterns thm.origin thm.patterns then
220+ if warn && params.ematch.containsWithSamePatterns thm.origin thm.patterns then
219221 warnRedundantEMatchArg params.ematch declName
220222 return { params with extra := params.extra.push thm }
221223 | .defn =>
0 commit comments