Zulip Chat Archive

Stream: Is there code for X?

Topic: Sections of a set in a product


Felix Weilacher (May 02 2024 at 21:02):

By a (vertical) section of a set a : Set X \times Y, I mean a set of the form {y : Y | (x,y) \in a} for some x : X.

Is there a good way to talk about these? I have been using a.curry x and it sometimes works as desired, but gives me some issues. For example I'm not sure how to fix the following error.

theorem mem_curry {α β : Type*} {a : Set (α × β)} (x : α) (y : β) :
    y  (a.curry x)  (x, y)  a := sorry
-- failed to synthesize instance Membership β (β → Prop)

Patrick Massot (May 02 2024 at 21:05):

This spelling is bound to bring pain on you.

Patrick Massot (May 02 2024 at 21:05):

It is violating the abstraction barrier of the definition of Set.

Patrick Massot (May 02 2024 at 21:07):

Did you try simply using Prod.mk x ⁻¹' a?

Kyle Miller (May 02 2024 at 21:08):

You can write it like this too:

theorem mem_curry {α β : Type*} {a : Set (α × β)} (x : α) (y : β) :
    y  (x, ·) ⁻¹' a  (x, y)  a := Set.mem_preimage

Kyle Miller (May 02 2024 at 21:09):

This has some nice symmetry:

example {α β : Type*} {a : Set (α × β)} (x : α) (y : β) :
    y  (x, ·) ⁻¹' a  (x, y)  a := Set.mem_preimage

example {α β : Type*} {a : Set (α × β)} (x : α) (y : β) :
    x  (·, y) ⁻¹' a  (x, y)  a := Set.mem_preimage

Patrick Massot (May 02 2024 at 21:10):

Oh yes, (x, ·) ⁻¹' a definitely reads better than Prod.mk x ⁻¹' a and has the nice benefit of working just as well with the right-hand set.

Patrick Massot (May 02 2024 at 21:10):

Yeah, I mean this symmetry.

Floris van Doorn (May 02 2024 at 21:11):

Oh, the parentheses of a pair also counts as parentheses surrounding ·? That's pretty neat

Felix Weilacher (May 02 2024 at 21:13):

Kyle Miller said:

This has some nice symmetry:

example {α β : Type*} {a : Set (α × β)} (x : α) (y : β) :
    y  (x, ·) ⁻¹' a  (x, y)  a := Set.mem_preimage

example {α β : Type*} {a : Set (α × β)} (x : α) (y : β) :
    x  (·, y) ⁻¹' a  (x, y)  a := Set.mem_preimage

Thanks! I will probably switch to this

Felix Weilacher (May 02 2024 at 21:16):

BTW, by rfl works in stead of Set.mem_preimage for the proof, but rfl doesn't.

Kyle Miller (May 02 2024 at 21:23):

Oh, that's because rfl is for Eq. You can use Iff.rfl here too.

Floris van Doorn (May 02 2024 at 21:25):

(or .rfl)

Felix Weilacher (May 02 2024 at 21:33):

thanks again


Last updated: May 02 2025 at 03:31 UTC