Zulip Chat Archive
Stream: new members
Topic: Dealing with "partial" functions
Nir Paz (Jun 15 2024 at 18:55):
If I have a function of type similar to Π x < b, α
, how can I easily state that an element is in its range?
For example I want H
to be the assumption that there is some i < 7
that is sent to 0
, and the ways I found are silly:
import Mathlib
-- stupid
example (f : Π n < 7, ℕ) (H : ∃ i < 7, ((h : i < 7) → f i h = 0)) : True := trivial
-- stupider
example (f : Π n < 7, ℕ) (H : ∃ i, Nonempty ((h : i < 7) ×' (f i h = 0))) : True := trivial
Kyle Miller (Jun 15 2024 at 19:08):
∃ i < 7, ((h : i < 7) → f i h = 0)
isn't stated right, since the implication makes it be trivially true (use i = 7
for example).
You can write (H : ∃ (i : ℕ) (h : i < 7), f i h = 0)
for a "dependent conjunction". If you don't want the type ascription, you can also write ∃ i, ∃ (h : i < 7), f i h = 0
by splitting the existential.
Kyle Miller (Jun 15 2024 at 19:10):
I think the summary is that the existential is how you write Nonempty (... ×' ...)
Nir Paz (Jun 15 2024 at 19:11):
Just found the theorem I was proving in mathlib and they use ∃ i h, f i h = 0
, thanks!
Last updated: May 02 2025 at 03:31 UTC