Zulip Chat Archive

Stream: new members

Topic: injection and surjection


Alex Zhang (Jul 10 2021 at 06:47):

Is there a subtype version for https://leanprover-community.github.io/mathlib_docs/data/set/function.html#set.inj_on?

Eric Wieser (Jul 10 2021 at 06:57):

Can you elaborate on what you mean by that?

Eric Wieser (Jul 10 2021 at 06:58):

Perhaps give an example of the sort of statement you're looking for?

Alex Zhang (Jul 10 2021 at 07:06):

Yeah. set.inj_on is def set.inj_on {α : Type u} {β : Type v} (f : α → β) (s : set α) : Prop meaning f is injective on s if the restriction of f to s is injective. Something like subtype.inj_onis jsut changing (s : set α) to s being a subtype of α.

Eric Wieser (Jul 10 2021 at 07:22):

Can you write out what you want instead of src#set.inj_on?

Eric Wieser (Jul 10 2021 at 07:23):

Which is

def inj_on (f : α  β) (s : set α) : Prop :=
 x₁ : α⦄, x₁  s   x₂ : α⦄, x₂  s  f x₁ = f x₂  x₁ = x₂

Eric Wieser (Jul 10 2021 at 07:24):

You might be after function.injective (f ∘ (coe : subtype p → α))

Alex Zhang (Jul 10 2021 at 07:31):

I was not thinking a precise def as I am looking for if there is anything already. The last one you gave seems to be a suggestion for the purpose I described.

Eric Wieser (Jul 10 2021 at 07:35):

It usually helps to give a precise def even if you're hoping it already exists

Eric Wieser (Jul 10 2021 at 07:36):

For one, that means you can use library_search to look for the def

Kevin Buzzard (Jul 10 2021 at 10:17):

Basically Eric is asking you to ask a precise question by writing some lean down


Last updated: Dec 20 2023 at 11:08 UTC