Zulip Chat Archive

Stream: Is there code for X?

Topic: ite_then_ite


Scott Morrison (May 14 2022 at 10:41):

Do we have lemmas like

lemma ite_then_dite {P Q : Prop} [decidable P] [decidable Q] {α : Type*} (a : α) (b : Q  α) (c : ¬Q  α) :
  (if P then (if h : Q then b h else c h) else a) = if h : Q then (if P then b h else a) else (if P then c h else a) :=
by split_ifs; refl

lemma ite_else_dite {P Q : Prop} [decidable P] [decidable Q] {α : Type*} (a : α) (b : Q  α) (c : ¬Q  α) :
  (if P then a else (if h : Q then b h else c h)) = if h : Q then (if P then a else b h) else (if P then a else c h) :=
by split_ifs; refl

in the library somewhere? I guess there are further variants change ite and dite.

Yaël Dillies (May 14 2022 at 10:43):

I had those lemmas on a branch then I noticed those were just applications of ite_apply and apply_ite

Yaël Dillies (May 14 2022 at 10:44):

If you really want them as standalone lemmas, I can PR them.

Scott Morrison (May 14 2022 at 11:03):

I'd like to rewrite by them, so yes I think I want them not just as ite_apply.

Scott Morrison (May 14 2022 at 11:03):

That would be lovely if you wanted to PR them. :-)

Scott Morrison (May 14 2022 at 11:03):

Ping me and I'll hit merge!

Yaël Dillies (May 14 2022 at 11:04):

Will do!

Eric Wieser (May 14 2022 at 11:14):

Is docs#if_assoc similar?

Eric Wieser (May 14 2022 at 11:15):

Hmm, I was sure that existed

Yaël Dillies (May 14 2022 at 11:16):

No, it doesn't because the branches don't really work out.

Yaël Dillies (May 14 2022 at 11:59):

I'm a bit mad at myself because I deleted the branch both on my local git and on Github :angry_cat:

Mauricio Collares (May 14 2022 at 12:03):

git reflog? And then git cherry-pick it onto a new branch if you find the missing commit

Yaël Dillies (May 14 2022 at 12:07):

Even if it was a month ago?

Eric Wieser (May 14 2022 at 13:20):

If it hasn't done a GC, then it should still be there

Yaël Dillies (May 14 2022 at 13:22):

Yeah I found it :smiley:

Yaël Dillies (May 14 2022 at 13:33):

#14146


Last updated: Dec 20 2023 at 11:08 UTC