Open fgdorais opened 6 years ago
FYI, for Lean 3.4.1, “[o]nly major bugs (e.g., soundness) will be fixed for this code base from now on” (e181232c8ffd2bc2ba1b2f9799f8ac0ea0e4e505), so I don't know if this change will be made. Given that, you may want to consider using mathlib, which has subtype.eq'
with the better signature:
import data.sigma.basic
#check @subtype.eq'
subtype.eq' : ∀ {α : Sort u_1} {β : α → Prop} {a1 a2 : {x // β x}}, a1.val = a2.val → a1 = a2
@spl Thanks for the reminder. This bug gave me some really unexpected errors so at least it's here for documentation purposes.
I didn't want to add mathlib as a dependency in my situation. An easy workaround is:
lemma subtype_eq {α : Sort*} {p : α → Prop} :
∀ {a1 a2 : subtype p}, a1.val = a2.val → a1 = a2
| ⟨x,h1⟩ ⟨.(x),h2⟩ rfl := rfl
The mathlib implementation is probably the same, but it comes with a lot of unnecessary baggage...
If you have "baggage restrictions", another viable approach is to pluck individual theorems from mathlib and add them to your project. At least in this early section there will be very few dependencies.
Prerequisites
Description
The signature of
subtype.eq
is incompatible with that ofsubtype
. (Specifically, the former doesn't acceptSort 0
while the latter does.)Steps to Reproduce
Expected behavior: [What you expect to happen]
Actual behavior: [What actually happens]
Reproduces how often: Always
Versions
Additional information
From
library/init/core.lean
: