Zulip Chat Archive

Stream: new members

Topic: Deconstructing existential statements


Trevor Hyde (Feb 08 2025 at 15:18):

I'm confused about why Lean gets upset if I remove the simp at hy line in the code below? I know I don't need both the have and the cases' lines, I was just testing to see if they behave differently.

open scoped Classical
variable (X Y : Type) (f : X  Y)

example (S T : Finset X) (h : S  T) : S.image f  T.image f := by
  intro y hy
  simp at hy

  -- These both work after `simp at hy`, but won't work without it.
  have x,hx := hy
  cases' hy with x hx
  done

spamegg (Feb 08 2025 at 16:01):

Is this Lean3 by any chance? It does not compile on the playground.

Julian Berman (Feb 08 2025 at 16:02):

It's just missing the imports . With import Mathlib, after the intro it looks like hy says y ∈ Finset.image f S -- and this isn't quite the same as saying there exists such an x, that's a lemma relating those, which simp is applying (or which you could rewrite with yourself).

Julian Berman (Feb 08 2025 at 16:02):

docs#Finset.mem_image

Kevin Buzzard (Feb 08 2025 at 16:21):

Yeah for sets this is rfl but for finsets it's not.


Last updated: May 02 2025 at 03:31 UTC