The Mathlib Handbook

The volumes of the handbook are not written yet. This site shows the map of Mathlib that they will follow, at Mathlib 4472534b60.

The areas / V01. The language of Mathlib

Mathlib.Logic.Function.Defs

55 declarations. Mathlib docs · Source

theorem Function.flip_def E0 #

∀ {α : Sort u₁} {β : Sort u₂} {φ : Sort u₃} {f : α → β → φ}, flip f = fun b a ↦ f a b

theorem Function.comp_assoc E1 #

∀ {α : Sort u₁} {β : Sort u₂} {φ : Sort u₃} {δ : Sort u₄} (f : φ → δ) (g : β → φ) (h : α → β), (f ∘ g) ∘ h = f ∘ g ∘ h

def Function.dcomp E1 #

{α : Sort u₁} →
  {β : α → Sort u₂} →
    {φ : {x : α} → β x → Sort u₃} → ({x : α} → (y : β x) → φ y) → (g : (x : α) → β x) → (x : α) → φ (g x)

Composition of dependent functions: (f ∘' g) x = f (g x), where type of g x depends on x and type of f (g x) depends on x and g x.

def Function.«term_∘'_» E1 #

Lean.TrailingParserDescr

Composition of dependent functions: (f ∘' g) x = f (g x), where type of g x depends on x and type of f (g x) depends on x and g x.

theorem Function.dcomp_def E0 #

∀ {ι : Sort u_3} {β : ι → Sort u_1} {φ : {i : ι} → β i → Sort u_2} (f : {i : ι} → (y : β i) → φ y) (g : (i : ι) → β i),
  f ∘' g = fun i ↦ f (g i)

theorem Function.dcomp_apply E0 #

∀ {ι : Sort u_3} {β : ι → Sort u_1} {φ : {i : ι} → β i → Sort u_2} (f : {i : ι} → (y : β i) → φ y) (g : (i : ι) → β i)
  (i : ι), (f ∘' g) i = f (g i)

theorem Function.dcomp_eq_comp E0 #

∀ {α : Sort u_3} {β : Sort u_4} {γ : Sort u_5} (f : β → γ) (g : α → β), (fun {x} ↦ f) ∘' g = f ∘ g

def Function.prod E1 #

{ι : Sort u_3} → {α : ι → Type u_1} → {β : ι → Type u_2} → ((i : ι) → α i) → ((i : ι) → β i) → (i : ι) → α i × β i

Product of functions: Function.prod f g i = (f i, g i), where the types of f i and g i may depend on i.

theorem Function.prod_def E0 #

∀ {ι : Sort u_3} {α : ι → Type u_1} {β : ι → Type u_2} (f : (i : ι) → α i) (g : (i : ι) → β i),
  Function.prod f g = fun i ↦ (f i, g i)

theorem Function.prod_apply E0 #

∀ {ι : Sort u_3} {α : ι → Type u_1} {β : ι → Type u_2} (f : (i : ι) → α i) (g : (i : ι) → β i) (i : ι),
  Function.prod f g i = (f i, g i)

theorem Function.prod_inj E0 #

∀ {ι : Sort u_3} {α : ι → Type u_1} {β : ι → Type u_2} {f f' : (i : ι) → α i} {g g' : (i : ι) → β i},
  Function.prod f g = Function.prod f' g' ↔ f = f' ∧ g = g'

theorem Function.prod_ext_iff E0 #

∀ {α : Type u_1} {β : Type u_2} {ι : Sort u_3} {h h' : ι → α × β},
  h = h' ↔ Prod.fst ∘ h = Prod.fst ∘ h' ∧ Prod.snd ∘ h = Prod.snd ∘ h'

theorem Function.prod_fst_snd E0 #

∀ {α : Type u_1} {β : Type u_2}, Function.prod Prod.fst Prod.snd = id

theorem Function.prod_snd_fst E0 #

∀ {α : Type u_1} {β : Type u_2}, Function.prod Prod.snd Prod.fst = Prod.swap

theorem Function.fst_comp_prod E0 #

∀ {α : Type u_1} {β : Type u_2} {ι : Sort u_3} (f : ι → α) (g : ι → β), Prod.fst ∘ Function.prod f g = f

theorem Function.snd_comp_prod E0 #

∀ {α : Type u_1} {β : Type u_2} {ι : Sort u_3} (f : ι → α) (g : ι → β), Prod.snd ∘ Function.prod f g = g

theorem Function.prod_fst_comp_snd_comp E0 #

∀ {α : Type u_1} {β : Type u_2} {ι : Sort u_3} (h : ι → α × β), Function.prod (Prod.fst ∘ h) (Prod.snd ∘ h) = h

theorem Function.const_prod E1 #

∀ {α : Type u_1} {β : Type u_2} {ι : Sort u_3} (p : α × β),
  Function.const ι p = Function.prod (Function.const ι p.1) (Function.const ι p.2)

theorem Function.prod_const_const E0 #

∀ {α : Type u_1} {β : Type u_2} {ι : Sort u_3} (a : α) (b : β),
  Function.prod (Function.const ι a) (Function.const ι b) = Function.const ι (a, b)

theorem Function.prod_comp E1 #

∀ {α : Type u_1} {β : Type u_2} {ι : Sort u_3} (f : ι → α) (g : ι → β) {κ : Sort u_4} (h : κ → ι),
  Function.prod f g ∘ h = Function.prod (f ∘ h) (g ∘ h)

theorem Function.prod_comp_fst_comp_snd E0 #

∀ {α₁ : Type u_4} {α₂ : Type u_5} {β₁ : Type u_6} {β₂ : Type u_7} (f : α₁ → α₂) (g : β₁ → β₂),
  Function.prod (f ∘ Prod.fst) (g ∘ Prod.snd) = Prod.map f g

theorem Function.map_comp_prod E0 #

∀ {α : Type u_1} {β : Type u_2} {ι : Sort u_3} (f : ι → α) (g : ι → β) {γ : Type u_4} {δ : Type u_5} (h : α → γ)
  (k : β → δ), Prod.map h k ∘ Function.prod f g = Function.prod (h ∘ f) (k ∘ g)

theorem Function.prod_comp_prod E1 #

∀ {α : Type u_1} {β : Type u_2} {ι : Sort u_3} (f : ι → α) (g : ι → β) {γ : Type u_4} {δ : Type u_5} (h : α × β → γ)
  (k : α × β → δ), Function.prod h k ∘ Function.prod f g = Function.prod (h ∘ Function.prod f g) (k ∘ Function.prod f g)

theorem Function.swap_comp_prod E0 #

∀ {α : Type u_1} {β : Type u_2} {ι : Sort u_3} (f : ι → α) (g : ι → β),
  Prod.swap ∘ Function.prod f g = Function.prod g f

def Function.diag E1 #

{α : Type u_1} → α → α × α

The diagonal map into Prod.

theorem Function.diag_def E0 #

∀ {α : Type u_1}, Function.diag = fun a ↦ (a, a)

theorem Function.diag_apply E0 #

∀ {α : Type u_1} (a : α), Function.diag a = (a, a)

theorem Function.diag_injective E1 #

∀ {α : Type u_1}, Function.Injective Function.diag

theorem Function.prod_id_id E0 #

∀ {α : Type u_1}, Function.prod id id = Function.diag

theorem Function.fst_comp_diag E0 #

∀ {α : Type u_1}, Prod.fst ∘ Function.diag = id

theorem Function.snd_comp_diag E0 #

∀ {α : Type u_1}, Prod.snd ∘ Function.diag = id

theorem Function.diag_comp E0 #

∀ {α : Type u_1} {β : Type u_2} (f : α → β), Function.diag ∘ f = Function.prod f f

theorem Function.map_comp_diag E0 #

∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} (f : α → β) (g : α → γ), Prod.map f g ∘ Function.diag = Function.prod f g

theorem Function.swap_comp_diag E0 #

∀ {α : Type u_1}, Prod.swap ∘ Function.diag = Function.diag

abbrev Function.onFun E1 #

{α : Sort u₁} → {β : Sort u₂} → {φ : Sort u₃} → (β → β → φ) → (α → β) → α → α → φ

Given functions f : β → β → φ and g : α → β, produce a function α → α → φ that evaluates g on each argument, then applies f to the results. Can be used, e.g., to transfer a relation from β to α.

def Function.term_On_ E1 #

Lean.TrailingParserDescr

Given functions f : β → β → φ and g : α → β, produce a function α → α → φ that evaluates g on each argument, then applies f to the results. Can be used, e.g., to transfer a relation from β to α.

abbrev Function.swap E1 #

{α : Sort u₁} → {β : Sort u₂} → {φ : α → β → Sort u₃} → ((x : α) → (y : β) → φ x y) → (y : β) → (x : α) → φ x y

For a two-argument function f, swap f is the same function but taking the arguments in the reverse order. swap f y x = f x y.

theorem Function.swap_def E0 #

∀ {α : Sort u₁} {β : Sort u₂} {φ : α → β → Sort u₃} (f : (x : α) → (y : β) → φ x y), Function.swap f = fun y x ↦ f x y

theorem Function.onFun_swap_comm E1 #

∀ {α : Sort u₁} {β : Sort u₂} {φ : Sort u₃} (f : β → β → φ) (g : α → β),
  Function.onFun (Function.swap f) g = Function.swap (Function.onFun f g)

def Function.Bijective E1 #

{α : Sort u₁} → {β : Sort u₂} → (α → β) → Prop

A function is called bijective if it is both injective and surjective.

theorem Function.Bijective.comp E1 #

∀ {α : Sort u₁} {β : Sort u₂} {φ : Sort u₃} {g : β → φ} {f : α → β},
  Function.Bijective g → Function.Bijective f → Function.Bijective (g ∘ f)

theorem Function.bijective_id E1 #

∀ {α : Sort u₁}, Function.Bijective id

theorem Function.Injective.beq_eq E0 #

∀ {α : Type u_1} {β : Type u_2} [inst : BEq α] [LawfulBEq α] [inst_2 : BEq β] [LawfulBEq β] {f : α → β},
  Function.Injective f → ∀ {a b : α}, (f a == f b) = (a == b)

def Function.bicompl E1 #

{α : Sort u_1} →
  {β : Sort u_2} → {γ : Sort u_3} → {δ : Sort u_4} → {ε : Sort u_5} → (γ → δ → ε) → (α → γ) → (β → δ) → α → β → ε

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.

def Function.bicompr E1 #

{α : Sort u_1} → {β : Sort u_2} → {γ : Sort u_3} → {δ : Sort u_4} → (γ → δ) → (α → β → γ) → α → β → δ

Compose a unary function f with a binary function g.

theorem Function.uncurry_bicompr E1 #

∀ {α : Type u_6} {β : Type u_7} {γ : Sort u_8} {δ : Sort u_9} (f : α → β → γ) (g : γ → δ),
  Function.uncurry (Function.bicompr g f) = g ∘ Function.uncurry f

theorem Function.uncurry_bicompl E1 #

∀ {α : Type u_6} {β : Type u_7} {γ : Type u_8} {δ : Type u_9} {ε : Sort u_10} (f : γ → δ → ε) (g : α → γ) (h : β → δ),
  Function.uncurry (Function.bicompl f g h) = Function.uncurry f ∘ Prod.map g h

def Function.IsFixedPt E1 #

{α : Type u₁} → (α → α) → α → Prop

A point x is a fixed point of f : α → α if f x = x.

theorem Function.IsFixedPt.eq E1 #

∀ {α : Type u₁} {f : α → α} {x : α}, Function.IsFixedPt f x → f x = x

If x is a fixed point of f, then f x = x. This is useful, e.g., for rw or simp.

instance Function.IsFixedPt.decidable E0 #

{α : Type u₁} → [h : DecidableEq α] → {f : α → α} → {x : α} → Decidable (Function.IsFixedPt f x)

theorem Function.IsFixedPt.of_subsingleton E1 #

∀ {α : Type u₁} [Subsingleton α] (f : α → α) (x : α), Function.IsFixedPt f x

theorem Function.isFixedPt_id E1 #

∀ {α : Type u₁} (x : α), Function.IsFixedPt id x

Every point is a fixed point of id.

theorem Function.forall_isFixedPt_iff E0 #

∀ {α : Type u₁} {f : α → α}, (∀ (x : α), Function.IsFixedPt f x) ↔ f = id

A function fixes every point iff it is the identity.

def Pi.map E1 #

{ι : Sort u_1} → {α : ι → Sort u_2} → {β : ι → Sort u_3} → ((i : ι) → α i → β i) → ((i : ι) → α i) → (i : ι) → β i

Sends a dependent function a : ∀ i, α i to a dependent function Pi.map f a : ∀ i, β i by applying f i to i-th component.

theorem Pi.map_apply E0 #

∀ {ι : Sort u_1} {α : ι → Sort u_2} {β : ι → Sort u_3} (f : (i : ι) → α i → β i) (a : (i : ι) → α i) (i : ι),
  Pi.map f a i = f i (a i)