Zulip Chat Archive
Stream: new members
Topic: How to prove this equality?
Antoine Chambert-Loir (Oct 12 2022 at 10:55):
I'm stuck on this…
example {ι : Type*} [decidable_eq ι] (p : α → ι) (s : finset ι)
(f : Π (i : ι), i ∈ s → equiv.perm ↥{a : α | p a = i})
(i j : ι) (hi : i ∈ s) (hj : j ∈ s) (h : i = j) :
equiv.perm.of_subtype (f j hj) = equiv.perm.of_subtype (f i hi) :=
Because rw h
does not work, even if one can rw
hi
and prove that it equal hj
…
Ruben Van de Velde (Oct 12 2022 at 10:56):
Did you try subst?
Antoine Chambert-Loir (Oct 12 2022 at 10:57):
No, I even didn't know about it…
— and it works, thanks!
Kevin Buzzard (Oct 12 2022 at 11:20):
subst
is a version of rw
which avoids "motive is not type correct" issues but only works if one side of the equality is a "bare" term, e.g. you cannot subst h
if h : a + b = c + d
.
Kevin Buzzard (Oct 12 2022 at 11:22):
import tactic
variables (α : Type)
example {ι : Type*} [decidable_eq ι] (p : α → ι) (s : finset ι)
(f : Π (i : ι), i ∈ s → equiv.perm ↥{a : α | p a = i})
(i j : ι) (hi : i ∈ s) (hj : j ∈ s) (h : i = j) :
equiv.perm.of_subtype (f j hj) = equiv.perm.of_subtype (f i hi) :=
begin
revert hi,
rw h,
intro hi,
refl,
end
works, because then all of the i's which need to be changed to j's to make the motive type-correct are present in the goal. This may or may not be what subst
is doing under the hood.
Riccardo Brasca (Oct 12 2022 at 12:55):
You can also try conv
.
Last updated: Dec 20 2023 at 11:08 UTC