Zulip Chat Archive
Stream: new members
Topic: case split on an element of a finset?
ROCKY KAMEN-RUBIO (Jun 21 2020 at 03:23):
I feel like there should be an easy way to do this but I can't find it.
import tactic
import data.finset
example {α : Type*} {y y1 y2 : α} {h : y ∈ ({y1, y2} : finset α )} : y = y1 ∨ y = y2 :=
begin
sorry
end
Kenny Lau (Jun 21 2020 at 03:35):
just cases
on h
Kenny Lau (Jun 21 2020 at 03:35):
or just finset.mem_insert
ROCKY KAMEN-RUBIO (Jun 21 2020 at 14:42):
cases h
gives me a cases tactic failed, it is not applicable to the given hypothesis
error.
import data.finset
import tactic
example {α : Type*} {y y1 y2 : α} {h : y ∈ ({y1, y2} : finset α )} : y = y1 ∨ y = y2 :=
begin
--rw finset.mem_insert at h,
cases h,
sorry,
end
This works for me though
import tactic
import data.finset
example {α : Type*} {y y1 y2 : α} {h : y ∈ ({y1, y2} : finset α )} : y = y1 ∨ y = y2 :=
begin
rw finset.mem_insert at h,
cases h,
{left, exact h},
rw finset.mem_singleton at h,
right
end
Kenny Lau (Jun 21 2020 at 14:58):
well I'm glad you found a way
Kenny Lau (Jun 21 2020 at 15:00):
fin_cases
might help
Kenny Lau (Jun 21 2020 at 15:04):
oh the statement doesn't even compile because you need decidable_eq
for the set notation
Kenny Lau (Jun 21 2020 at 15:04):
but it still doesn't work
Kenny Lau (Jun 21 2020 at 15:04):
import data.finset
import tactic
example {α : Type*} [decidable_eq α] {y y1 y2 : α} {h : y ∈ ({y1, y2} : finset α )} : y = y1 ∨ y = y2 :=
begin
fin_cases h,
sorry,
end
Kenny Lau (Jun 21 2020 at 15:05):
@Scott Morrison why doesn't this work?
Kenny Lau (Jun 21 2020 at 15:05):
cases tactic failed, it is not applicable to the given hypothesis
state:
α : Type ?,
_inst_1 : decidable_eq α,
y y1 y2 : α,
h : y ∈ {y1, y2}
⊢ y = y1 ∨ y = y2
Scott Morrison (Jun 21 2020 at 15:05):
a bug, I guess! :-) I'm not immediately sure. I can try to look tomorrow.
Rob Lewis (Jun 21 2020 at 15:06):
I dunno about fin_cases
but this should just be simpa using h
, right?
Last updated: Dec 20 2023 at 11:08 UTC