Zulip Chat Archive

Stream: Is there code for X?

Topic: Multiple cases at once


Marcus Rossel (Jun 02 2021 at 09:44):

I have three optional instances t1 t2 t3 : option nat and need to prove something about them case by case.
Is there a tactic that automatically produces all cases at once, such that all combinations of the instances being some _ or none are covered?
(That would be 8 goals in this example).

Eric Wieser (Jun 02 2021 at 09:50):

cases t1; cases t2; cases t3, should do the job

Marcus Rossel (Jun 02 2021 at 09:52):

Ahh I should have thought of that myself, thanks!

Scott Morrison (Jun 02 2021 at 09:55):

There is also a case_bash tactic somewhere... Apparently undocumented.

Eric Wieser (Jun 02 2021 at 09:57):

I think this should work too, but my orange bars are stuck so I can't confirm:

import tactic

example :  (t1 t2 t3 : option nat), true :=
begin
  rintros (a|_) (b|_) (c|_),
end

Last updated: Dec 20 2023 at 11:08 UTC