Skip to content

Commit b1434b1

Browse files
committed
Use isBRecOnRecursor
1 parent d00833a commit b1434b1

File tree

2 files changed

+6
-21
lines changed

2 files changed

+6
-21
lines changed

src/Lean/Elab/PreDefinition/Structural/Eqns.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ where
5050
unless brecOn.isConst do
5151
throwError "goal not headed by `.brecOn`\n{MessageData.ofGoal mvarId}"
5252
let brecOnName := brecOn.constName!
53-
unless Name.isSuffixOf `brecOn brecOnName do
53+
unless isBRecOnRecursor (← getEnv) brecOnName do
5454
throwError "goal not headed by `.brecOn`\n{MessageData.ofGoal mvarId}"
5555
let brecOnThmName := brecOnName.str "eq"
5656
unless (← hasConst brecOnThmName) do

tests/lean/run/structuralEqns5.lean

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,11 @@ info: theorem Tree.size.eq_def.{u_1} : ∀ {α : Type u_1} (x : Tree α),
2020
#print sig Tree.size.eq_def
2121

2222
/--
23-
error: Failed to realize constant Tree.size_aux.eq_def:
24-
failed to generate equational theorem for `Tree.size_aux`
25-
goal not headed by `.brecOn`
26-
α : Type u_1
27-
x✝ : List (Tree α)
28-
⊢ (Tree.brecOn_1 x✝
29-
(fun x f =>
30-
(match (motive := (x : Tree α) → x.below → Nat) x with
31-
| Tree.node a tsf => fun x => 1 + (x true).1 + (x false).1)
32-
f)
33-
fun x f =>
34-
(match (motive := (x : List (Tree α)) → Tree.below_1 x → Nat) x with
35-
| [] => fun x => 0
36-
| t :: ts => fun x => x.1.1 + x.2.1)
37-
f) =
38-
match x✝ with
39-
| [] => 0
40-
| t :: ts => t.size + Tree.size_aux ts
41-
---
42-
error: Unknown constant `Tree.size_aux.eq_def`
23+
info: theorem Tree.size_aux.eq_def.{u_1} : ∀ {α : Type u_1} (x : List (Tree α)),
24+
Tree.size_aux x =
25+
match x with
26+
| [] => 0
27+
| t :: ts => t.size + Tree.size_aux ts
4328
-/
4429
#guard_msgs in
4530
#print sig Tree.size_aux.eq_def

0 commit comments

Comments
 (0)