Miscellaneous function constructions and lemmas
Evaluate a function at an argument. Useful if you want to talk about the partially applied
function.eval x : (Π x, β x) → β x
.
Equations
- function.eval x f = f x
If the co-domain β
of an injective function f : α → β
has decidable equality, then
the domain α
also has decidable equality.
Equations
- I.decidable_eq = λ (a b : α), decidable_of_iff (f a = f b) _
Equations
- function.decidable_eq_pfun p α f g = decidable_of_iff (∀ (hp : p), f hp = g hp) _
Cantor's diagonal argument implies that there are no surjective functions from α
to set α
.
Cantor's diagonal argument implies that there are no injective functions from set α
to α
.
g
is a partial inverse to f
(an injective but not necessarily
surjective function) if g y = some x
implies f x = y
, and g y = none
implies that y
is not in the range of f
.
Equations
- function.is_partial_inv f g = ∀ (x : α) (y : β), g y = option.some x ↔ f x = y
We can use choice to construct explicitly a partial inverse for
a given injective function f
.
Equations
- function.partial_inv f b = dite (∃ (a : α), f a = b) (λ (h : ∃ (a : α), f a = b), option.some (classical.some h)) (λ (h : ¬∃ (a : α), f a = b), option.none)
Construct the inverse for a function f
on domain s
. This function is a right inverse of f
on f '' s
.
Equations
- function.inv_fun_on f s b = dite (∃ (a : α), a ∈ s ∧ f a = b) (λ (h : ∃ (a : α), a ∈ s ∧ f a = b), classical.some h) (λ (h : ¬∃ (a : α), a ∈ s ∧ f a = b), classical.choice n)
The inverse of a function (which is a left inverse if f
is injective
and a right inverse if f
is surjective).
Equations
The inverse of a surjective function. (Unlike inv_fun
, this does not require
α
to be inhabited.)
Equations
- function.surj_inv h b = classical.some _
Replacing the value of a function at a given point by a given value.
Compose a binary function f
with a pair of unary functions g
and h
.
If both arguments of f
have the same type and g = h
, then bicompl f g g = f on g
.
Equations
- function.bicompl f g h a b = f (g a) (h b)
Compose an unary function f
with a binary function g
.
Equations
- function.bicompr f g a b = f (g a b)
A function is involutive, if f ∘ f = id
.
Equations
- function.involutive f = ∀ (x : α), f (f x) = x
The property of a binary function f : α → β → γ
being injective.
Mathematically this should be thought of as the corresponding function α × β → γ
being injective.
sometimes f
evaluates to some value of f
, if it exists. This function is especially
interesting in the case where α
is a proposition, in which case f
is necessarily a
constant function, so that sometimes f = f a
for all a
.
Equations
- function.sometimes f = dite (nonempty α) (λ (h : nonempty α), f (classical.choice h)) (λ (h : ¬nonempty α), classical.choice _inst_1)