Zulip Chat Archive

Stream: Is there code for X?

Topic: pfun to total function


Bernd Losert (Apr 09 2022 at 14:14):

I don't see a function that takes an f : α →. β and gives me back f.dom → β. The closest seems to be pfun.fn. Or am I not looking hard enough?

Eric Wieser (Apr 09 2022 at 14:30):

What type is docs#pfun.dom?

Eric Wieser (Apr 09 2022 at 14:31):

You're looking for docs#pfun.as_subtype

Eric Wieser (Apr 09 2022 at 14:31):

Did you try library_search?

Bernd Losert (Apr 09 2022 at 14:37):

Ah, that's what it's called. No, I didn't try library_search for this.

Bernd Losert (Apr 09 2022 at 15:16):

Hmm... is there an equivalent to pfun but for option? data.pfun has a lot of functions that I need, but I need option versions.

Eric Wieser (Apr 09 2022 at 15:37):

Can you write your question as a #mwe? If you do, then library_search might be able to answer it

Bernd Losert (Apr 09 2022 at 16:24):

For example,

example (f : α  option β) : {x : α | is_some (f x)}  β := by library_search

Bernd Losert (Apr 09 2022 at 16:27):

Hmm... I realize that I need to talk about "nondegenerate" α → option β functions, i.e. there is at least one value that produces a some.

Eric Wieser (Apr 09 2022 at 16:45):

That seems less likely to exist (and maybe less worthwhile to have in mathlib), but should be trivial to define for your own use

Eric Wieser (Apr 09 2022 at 16:46):

Something like λ a, (f a).get (f a).prop


Last updated: Dec 20 2023 at 11:08 UTC