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, and its restricted variant Function.IsConstOn, the predicate that a function takes the same value at every pair of points of a given set.

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 functions on a subsingleton domain are constant.

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

    All functions 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.exists_eq_const {α : Sort u_1} {β : Sort u_2} [Nonempty β] {f : α → β} :
    IsConst f → ∃ (b : β), f = const α b

    Alias of the forward direction of Function.isConst_iff_exists_eq_const.


    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 Set.subsingleton_range_iff {α : Sort u_1} {β : Type u_4} {f : α → β} :
    @[simp]
    theorem Set.nontrivial_range_iff {α : Sort u_1} {β : Type u_4} {f : α → β} :
    theorem Function.isConst_and_injective_iff {α : Sort u_1} {β : Sort u_2} (f : α → β) :
    theorem Function.IsConst.injective_iff {α : Sort u_1} {β : Sort u_2} {f : α → β} (h : IsConst f) :
    theorem Function.Injective.isConst_iff {α : Sort u_1} {β : Sort u_2} {f : α → β} (h : Injective f) :
    theorem Function.isConst_and_surjective_iff {α : Sort u_1} {β : Sort u_2} (f : α → β) :
    theorem Function.IsConst.surjective_iff {α : Sort u_1} {β : Sort u_2} [Nonempty α] {f : α → β} (h : IsConst f) :
    theorem Function.Surjective.isConst_iff {α : Sort u_1} {β : Sort u_2} {f : α → β} (h : Surjective f) :
    def Function.IsConstOn {β : Sort u_2} {α : Type u_4} (f : α → β) (s : Set α) :

    A function is constant on a set s if it takes equal values at any two points of s.

    The intended use is for expressing that a function is constant on s when the exact constant value is not known, not unique or not easy to express. To state the constant value explicitly, use Set.EqOn f (Function.const α b) s.

    Equations
    Instances For
      theorem Function.isConstOn_iff {β : Sort u_2} {α : Type u_4} {f : α → β} {s : Set α} :
      IsConstOn f s ↔ ∀ (x : α), x ∈ s → ∀ (y : α), y ∈ s → f x = f y
      theorem Function.IsConstOn.eq {β : Sort u_2} {α : Type u_4} {f : α → β} {s : Set α} (hf : IsConstOn f s) {x y : α} (hx : x ∈ s) (hy : y ∈ s) :
      f x = f y
      theorem Function.isConstOn_iff_isConst_comp_val {β : Sort u_2} {α : Type u_4} (f : α → β) (s : Set α) :
      @[simp]
      theorem Function.isConstOn_univ {β : Sort u_2} {α : Type u_4} (f : α → β) :
      theorem Function.IsConst.isConstOn {β : Sort u_2} {α : Type u_4} {f : α → β} {s : Set α} (hf : IsConst f) :
      theorem Function.IsConstOn.anti {β : Sort u_2} {α : Type u_4} {f : α → β} {s t : Set α} (hf : IsConstOn f t) (hst : s ⊆ t) :
      theorem Function.IsConstOn.of_eqOn {α : Type u_4} {β : Type u_5} {f g : α → β} {s : Set α} (hf : IsConstOn f s) (h : Set.EqOn f g s) :
      theorem Function.IsConstOn.congr {α : Type u_4} {β : Type u_5} {f g : α → β} {s t : Set α} (hf : IsConstOn f s) (h : Set.EqOn f g s) (hst : s = t) :
      theorem Set.EqOn.isConstOn_iff {α : Type u_4} {β : Type u_5} {f g : α → β} {s : Set α} (h : EqOn f g s) :
      @[simp]
      theorem Function.IsConstOn.const {β : Sort u_2} {α : Type u_4} (b : β) (s : Set α) :
      IsConstOn (const α b) s
      @[simp]
      theorem Function.IsConstOn.fun_const {β : Sort u_2} {α : Type u_4} (b : β) (s : Set α) :
      IsConstOn (fun (x : α) => b) s
      theorem Function.IsConstOn.of_subsingleton {β : Sort u_2} {α : Type u_4} {s : Set α} (hs : s.Subsingleton) (f : α → β) :

      Every function is constant on a subsingleton set.

      @[simp]
      theorem Function.isConstOn_empty {β : Sort u_2} {α : Type u_4} (f : α → β) :
      @[simp]
      theorem Function.isConstOn_singleton {β : Sort u_2} {α : Type u_4} (f : α → β) (a : α) :
      theorem Function.IsConstOn.of_forall_eq {β : Sort u_2} {α : Type u_4} {f : α → β} {s : Set α} (b : β) (h : ∀ (x : α), x ∈ s → f x = b) :
      theorem Function.isConstOn_iff_exists_forall_eq {β : Sort u_2} {α : Type u_4} [Nonempty β] {f : α → β} {s : Set α} :
      IsConstOn f s ↔ ∃ (b : β), ∀ (x : α), x ∈ s → f x = b

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

      theorem Function.isConstOn_iff_exists_forall_eq_of_nonempty {β : Sort u_2} {α : Type u_4} {f : α → β} {s : Set α} (hs : s.Nonempty) :
      IsConstOn f s ↔ ∃ (b : β), ∀ (x : α), x ∈ s → f x = b

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

      theorem Function.isConstOn_iff_exists_eqOn_const {α : Type u_4} {β : Type u_5} [Nonempty β] {f : α → β} {s : Set α} :
      IsConstOn f s ↔ ∃ (b : β), Set.EqOn f (const α b) s

      A function α → β to a non-empty codomain is constant on s if and only if there is b : β so that the function agrees with Function.const α b on s.

      theorem Function.IsConstOn.exists_eqOn_const {α : Type u_4} {β : Type u_5} [Nonempty β] {f : α → β} {s : Set α} :
      IsConstOn f s → ∃ (b : β), Set.EqOn f (const α b) s

      Alias of the forward direction of Function.isConstOn_iff_exists_eqOn_const.


      A function α → β to a non-empty codomain is constant on s if and only if there is b : β so that the function agrees with Function.const α b on s.

      theorem Function.isConstOn_iff_exists_eqOn_const_of_nonempty {α : Type u_4} {β : Type u_5} {f : α → β} {s : Set α} (hs : s.Nonempty) :
      IsConstOn f s ↔ ∃ (b : β), Set.EqOn f (const α b) s

      A function α → β is constant on a non-empty set s if and only if there is b : β so that the function agrees with Function.const α b on s.

      theorem Function.IsConstOn.comp_left {β : Sort u_2} {γ : Sort u_3} {α : Type u_4} {f : α → β} {s : Set α} (hf : IsConstOn f s) (g : β → γ) :
      IsConstOn (g ∘ f) s

      Postcomposition preserves being constant on a set.

      theorem Function.IsConstOn.comp_right {α : Type u_4} {γ : Type u_5} {g : γ → γ} {t : Set γ} (hg : IsConstOn g t) {f : α → γ} {s : Set α} (hf : Set.MapsTo f s t) :
      IsConstOn (g ∘ f) s

      Precomposing a function constant on t with a function mapping s to t gives a function constant on s.

      theorem Function.IsConst.isConstOn_comp {α : Type u_4} {γ : Sort u_5} {g : γ → γ} (hg : IsConst g) (f : α → γ) (s : Set α) :
      IsConstOn (g ∘ f) s

      Precomposing a constant function gives a function constant on any set.

      theorem Function.not_isConstOn_of_apply_ne {β : Sort u_2} {α : Type u_4} {f : α → β} {s : Set α} {x y : α} (hx : x ∈ s) (hy : y ∈ s) (h : f x ≠ f y) :
      theorem Function.not_isConstOn_iff_exists_apply_ne {β : Sort u_2} {α : Type u_4} {f : α → β} {s : Set α} :
      ¬IsConstOn f s ↔ ∃ (x : α), x ∈ s ∧ ∃ (y : α), y ∈ s ∧ f x ≠ f y
      theorem Function.isConstOn_id_iff {α : Type u_4} {s : Set α} :

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

      @[simp]
      theorem Set.subsingleton_image_iff {α : Type u_4} {β : Type u_5} {f : α → β} {s : Set α} :
      @[simp]
      theorem Set.nontrivial_image_iff {α : Type u_4} {β : Type u_5} {f : α → β} {s : Set α} :
      theorem Function.isConstOn_and_injOn_iff {α : Type u_4} {β : Type u_5} (f : α → β) (s : Set α) :
      theorem Function.IsConstOn.injOn_iff {α : Type u_4} {β : Type u_5} {f : α → β} {s : Set α} (h : IsConstOn f s) :
      @[simp]
      theorem Set.InjOn.isConstOn_iff {α : Type u_4} {β : Type u_5} {f : α → β} {s : Set α} (h : InjOn f s) :