Zulip Chat Archive

Stream: general

Topic: negation of earlier cases of match


Nima (Apr 24 2018 at 12:48):

(deleted)

Nima (Apr 24 2018 at 12:50):

How should I change the following code, so in the second case I know a is not aa?

inductive ind | aa | bb
open ind
example : ind  ind  ind  ind  nat
| aa _  _ _ := 0
| a  aa _ _ := sorry
| _  _  _ _ := 0

Kenny Lau (Apr 24 2018 at 12:53):

you can change the title next time

Kenny Lau (Apr 24 2018 at 12:53):

type bb instead of a

Kenny Lau (Apr 24 2018 at 12:53):

(it can't know inside a match what conditions are not yet matched)

Nima (Apr 24 2018 at 12:55):

How do I change the title?
what if I have
inductive ind | aa | bb | cc | dd

Kenny Lau (Apr 24 2018 at 12:55):

maybe could you give us the whole context? I sense some XY problem going on here

Kenny Lau (Apr 24 2018 at 12:55):

sorry

Johan Commelin (Apr 24 2018 at 12:55):

How do I change the title?

Just edit the post. There will be a field to edit the title as well.

Simon Hudon (Apr 24 2018 at 12:56):

what if I have
inductive ind | aa | bb | cc | dd

I think you'd need an if _ then _ else _ and a match inside one of the branches

Kenny Lau (Apr 24 2018 at 12:56):

ite is hard to destruct. I don't recommend using it at all unless necessary

Kenny Lau (Apr 24 2018 at 12:56):

I'm sure his situation has other ways out

Simon Hudon (Apr 24 2018 at 12:57):

It would help if you derived decidable_eq:

@[derive decidable_eq]
inductive ind | aa | bb | cc | dd

Simon Hudon (Apr 24 2018 at 12:59):

Kenny, the alternative would be to match on all branches.

Kenny Lau (Apr 24 2018 at 13:00):

one can't be so sure

Nima (Apr 24 2018 at 13:03):

So if I have a sparse match on many variables, and in each case I want to use the fact that previous cases were not a match, I would be better off with if-then-else. Right?

Simon Hudon (Apr 24 2018 at 13:04):

Exactly

Nima (Apr 24 2018 at 13:04):

Thanks


Last updated: Dec 20 2023 at 11:08 UTC