Skip to content

Commit a408195

Browse files
committed
fix: noConfusion shape info mistake
This PR fixes noConfusion compilation. fixes #11610.
1 parent eee58f4 commit a408195

File tree

3 files changed

+30
-3
lines changed

3 files changed

+30
-3
lines changed

src/Lean/Meta/Constructions/NoConfusion.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,9 +262,9 @@ def mkNoConfusionCoreImp (indName : Name) : MetaM Unit := do
262262
(value := e)
263263
(hints := ReducibilityHints.abbrev)))
264264
setReducibleAttribute declName
265-
let arity := info.numParams + 1 + 3 * (info.numIndices + 1)
266-
let lhsPos := info.numParams + 1 + info.numIndices
267-
let rhsPos := info.numParams + 1 + info.numIndices + 1 + info.numIndices
265+
let arity := 1 + 3 * (info.numParams + info.numIndices + 1)
266+
let lhsPos := 1 + info.numParams + info.numIndices
267+
let rhsPos := 1 + 2 * info.numParams + 2 * info.numIndices + 1
268268
modifyEnv fun env => markNoConfusion env declName (.regular arity lhsPos rhsPos)
269269
modifyEnv fun env => addProtected env declName
270270

stage0/src/stdlib_flags.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#include "util/options.h"
22

3+
// Please update stage0
4+
35
namespace lean {
46
options get_default_options() {
57
options opts;

tests/lean/run/issue11610.lean

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import Lean
2+
3+
variable {α β γ δ : Sort _}
4+
5+
structure Prod' (α : Type u) (β : Type v) where
6+
/--
7+
Constructs a pair. This is usually written `(x, y)` instead of `Prod.mk x y`.
8+
-/
9+
mk ::
10+
/-- The first element of a pair. -/
11+
fst : α
12+
/-- The second element of a pair. -/
13+
snd : β
14+
15+
def mk.injArrow' {α : Type _} {β : Type _} {x₁ : α} {y₁ : β} {x₂ : α} {y₂ : β} :
16+
Prod'.mk x₁ y₁ = Prod'.mk x₂ y₂ → ∀ ⦃P : Sort _⦄, (x₁ = x₂ → y₁ = y₂ → P) → P :=
17+
fun h₁ _ h₂ ↦ Prod'.noConfusion rfl rfl (heq_of_eq h₁)
18+
(fun h₃ h₄ ↦ h₂ (eq_of_heq h₃) (eq_of_heq h₄))
19+
20+
-- Also for structures in Init:
21+
22+
def mk.injArrow {α : Type _} {β : Type _} {x₁ : α} {y₁ : β} {x₂ : α} {y₂ : β} :
23+
Prod.mk x₁ y₁ = Prod.mk x₂ y₂ → ∀ ⦃P : Sort _⦄, (x₁ = x₂ → y₁ = y₂ → P) → P :=
24+
fun h₁ _ h₂ ↦ Prod.noConfusion rfl rfl (heq_of_eq h₁)
25+
(fun h₃ h₄ ↦ h₂ (eq_of_heq h₃) (eq_of_heq h₄))

0 commit comments

Comments
 (0)