Zulip Chat Archive

Stream: general

Topic: if-then-else & simp


Alexander Bentkamp (Mar 09 2019 at 03:48):

Hello, I stumbled upon a curious behavior of simp with if-then-else:

Here, simp cannot resolve the if-then-else:

example {γ : Type*} [decidable_eq γ] (x : γ) (a b : ) (as : γ  )
(h : as = λ(k : γ), ite (x = k) a b) : as x = a :=
begin
  simp [h],   -- ⊢ ite (x = x) a b = a
  sorry
end

Here, it can:

begin
  rw h,
  simp
end

But it looks like rw h does exactly the same as simp [h] above.

Does someone know what's going on here?

Mario Carneiro (Mar 09 2019 at 04:19):

I don't think they are actually different, seeing as this works too:

begin
  simp [h],   -- ⊢ ite (x = x) a b = a
  simp,
end

Mario Carneiro (Mar 09 2019 at 04:20):

I suspect that the beta redex is causing simp to not see the second simplification until after the first is complete

Alexander Bentkamp (Mar 09 2019 at 05:22):

Oh, that makes sense. Thank you.

Kevin Buzzard (Mar 09 2019 at 06:59):

It doesn't make sense to me. What is "beta redex"?

Mario Carneiro (Mar 09 2019 at 07:34):

(\lam x, A) B

Kevin Buzzard (Mar 09 2019 at 07:37):

oh -- it's the same as beta reduction?

Mario Carneiro (Mar 09 2019 at 07:37):

beta reduction is the simplification of beta redexes

Mario Carneiro (Mar 09 2019 at 07:37):

a beta redex is a thing that is subject to beta reduction

Kevin Buzzard (Mar 09 2019 at 07:38):

Aah I see. OK I've now googled. Thanks.


Last updated: Dec 20 2023 at 11:08 UTC