Zulip Chat Archive
Stream: Is there code for X?
Topic: cases matching with
Bolton Bailey (Sep 13 2021 at 20:36):
Is there a tactic or arguments to combine the functionality of cases ... with ...
with the functionality of cases_matching
? I'd like to be able to reference by name the constructors I get from cases_matching
. cases_matching ... with ...
doesn't seem to work.
example (p q : Prop) (h1 : p ∨ q) : false :=
begin
-- cases h1 with h_left h_right, -- what I want to do without referencing h1
cases_matching (_ ∨ _) with h_left h_right, -- invalid
end
Eric Rodriguez (Sep 13 2021 at 20:41):
maybe you want the ‹...›
syntax?
cases ‹_ ∨ _› with h_left h_right, -- valid
Bolton Bailey (Sep 13 2021 at 20:44):
Sweet, that works, thank you. Is there someplace I can learn more about this ‹...› syntax?
Yaël Dillies (Sep 13 2021 at 20:46):
Is it the same as the one you use to implicitly call assumption
?
Eric Rodriguez (Sep 13 2021 at 20:46):
think of ‹...›
as show ... by assumption
Eric Rodriguez (Sep 13 2021 at 20:46):
yes Yaël
Yaël Dillies (Sep 13 2021 at 20:46):
Ahah! Yes :wink:
Bolton Bailey (Sep 13 2021 at 20:47):
Cool, thanks
Yaël Dillies (Sep 13 2021 at 20:48):
The most useful place to use it is after a ;
, because you might have want to call the exact same lemma in all of the cases but the hypotheses have to be shuffled around.
Bolton Bailey (Sep 21 2021 at 09:45):
I currently want to do something like the following
cases_success <- try_core `[cases ‹_ ∨ _› with nm nm],
match cases_success with
| some _ := all_goals' `[rw nm at *, done <|> id { integral_domain_tactic }]
| none := skip
But I would rather nm
not just be nm every time so it doesn't overwrite itself when I call this recursively. Is there some way to get cases ‹_ ∨ _›
to output the name of the value it destructs? Or to call nm <- get_unused_name
and have that be inserted after with
?
Last updated: Dec 20 2023 at 11:08 UTC