Documentation

Mathlib.Logic.Function.Const

Constant functions #

This file defines Function.IsConst, the predicate that a function takes the same value at every pair of inputs.

Note that a function with empty domain is considered constant. If a constant function has non-empty codomain, then it can be represented by Function.const, see isConst_iff_exists_eq_const.

def Function.IsConst {α : Sort u_1} {β : Sort u_2} (f : αβ) :

A function is constant if it takes equal values at any two inputs.

Note that a function with empty domain is considered constant. If a constant function has non-empty co domain, then it can be represented by Function.const, see isConst_iff_exists_eq_const.

The intended use is for expressing that a function is constant when the exact constant value is not known, not unique or not easy to express. To state the constant value explicitly, use Function.const.

Equations
Instances For
    theorem Function.isConst_iff {α : Sort u_1} {β : Sort u_2} {f : αβ} :
    IsConst f ∀ (x y : α), f x = f y
    theorem Function.IsConst.eq {α : Sort u_1} {β : Sort u_2} {f : αβ} (hf : IsConst f) (x y : α) :
    f x = f y
    @[simp]
    theorem Function.IsConst.const {α : Sort u_1} {β : Sort u_2} (b : β) :
    IsConst (const α b)
    @[simp]
    theorem Function.IsConst.of_subsingleton_domain {α : Sort u_1} {β : Sort u_2} [Subsingleton α] (f : αβ) :

    All function on a subsingleton domain are constant.

    @[simp]
    theorem Function.IsConst.of_subsingleton_codomain {α : Sort u_1} {β : Sort u_2} [Subsingleton β] (f : αβ) :

    All function to a subsingleton codomain are constant.

    theorem Function.IsConst.of_forall_eq {α : Sort u_1} {β : Sort u_2} {f : αβ} (b : β) (h : ∀ (x : α), f x = b) :
    theorem Function.isConst_iff_exists_forall_eq {α : Sort u_1} {β : Sort u_2} [Nonempty β] {f : αβ} :
    IsConst f ∃ (b : β), ∀ (x : α), f x = b

    A function f : α → β is constant on a non-empty codomain if and only if there is b : β so that f a = b for all a : α.

    theorem Function.isConst_iff_exists_forall_eq_of_nonempty_domain {α : Sort u_1} {β : Sort u_2} [Nonempty α] {f : αβ} :
    IsConst f ∃ (b : β), ∀ (x : α), f x = b

    A function f : α → β is constant on a non-empty domain if and only if there is b : β so that f a = b for all a : α.

    theorem Function.isConst_iff_exists_eq_const {α : Sort u_1} {β : Sort u_2} [Nonempty β] {f : αβ} :
    IsConst f ∃ (b : β), f = const α b

    A function α → β is constant on a non-empty codomain if and only if there is b : β so that the function can be written as Function.const α b.

    theorem Function.isConst_iff_exists_eq_const_of_nonempty_domain {α : Sort u_1} {β : Sort u_2} [Nonempty α] {f : αβ} :
    IsConst f ∃ (b : β), f = const α b

    A function α → β is constant on a non-empty domain if and only if there is b : β so that the function can be written as Function.const α b.

    theorem Function.IsConst.comp_left {α : Sort u_1} {β : Sort u_2} {γ : Sort u_3} {f : αβ} (hf : IsConst f) (g : βγ) :
    IsConst (g f)

    Postcomposition preserves being constant.

    theorem Function.IsConst.comp_right {α : Sort u_1} {β : Sort u_2} {γ : Sort u_3} {g : βγ} (hg : IsConst g) (f : αβ) :
    IsConst (g f)

    Precomposing a constant function gives a constant function.

    theorem Function.not_isConst_of_apply_ne {α : Sort u_1} {β : Sort u_2} {f : αβ} {x y : α} (h : f x f y) :
    theorem Function.not_isConst_iff_exists_apply_ne {α : Sort u_1} {β : Sort u_2} {f : αβ} :
    ¬IsConst f ∃ (x : α) (y : α), f x f y
    @[simp]

    The identity function on a type is constant if and only if the type is a subsingleton.

    @[simp]
    theorem Setoid.ker_eq_top {α : Type u_4} {β : Type u_5} {f : αβ} :