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.Basic.PEquiv

76 declarations. Mathlib docs · Source

Partial Equivalences

In this file, we define partial equivalences PEquiv, which are a bijection between a subset of α and a subset of β. Notationally, a PEquiv is denoted by "≃." (note that the full stop is part of the notation). The way we store these internally is with two functions f : α → Option β and the reverse function g : β → Option α, with the condition that if f a is some b, then g b is some a.

Main results

  • PEquiv.ofSet: creates a PEquiv from a set s, which sends an element to itself if it is in s.
  • PEquiv.single: given two elements a : α and b : β, create a PEquiv that sends them to each other, and ignores all other elements.
  • PEquiv.injective_of_forall_ne_isSome/injective_of_forall_isSome: If the domain of a PEquiv is all of α (except possibly one point), its toFun is injective.

Canonical order

PEquiv is canonically ordered by inclusion; that is, if a function f defined on a subset s is equal to g on that subset, but g is also defined on a larger set, then f ≤ g. We also have a definition of ⊥, which is the empty PEquiv (sends all to none), which in the end gives us a SemilatticeInf with an OrderBot instance.

Tags

pequiv, partial equivalence

theorem PEquiv.mk.congr_simp E1 #

∀ {α : Type u} {β : Type v} (toFun toFun_1 : α → Option β) (e_toFun : toFun = toFun_1) (invFun invFun_1 : β → Option α)
  (e_invFun : invFun = invFun_1) (inv : ∀ (a : α) (b : β), invFun b = some a ↔ toFun a = some b),
  { toFun := toFun, invFun := invFun, inv := inv } = { toFun := toFun_1, invFun := invFun_1, inv := ⋯ }

theorem PEquiv.mk.injEq E0 #

∀ {α : Type u} {β : Type v} (toFun : α → Option β) (invFun : β → Option α)
  (inv : ∀ (a : α) (b : β), invFun b = some a ↔ toFun a = some b) (toFun_1 : α → Option β) (invFun_1 : β → Option α)
  (inv_1 : ∀ (a : α) (b : β), invFun_1 b = some a ↔ toFun_1 a = some b),
  ({ toFun := toFun, invFun := invFun, inv := inv } = { toFun := toFun_1, invFun := invFun_1, inv := inv_1 }) =
    (toFun = toFun_1 ∧ invFun = invFun_1)

theorem PEquiv.ofSet.congr_simp E1 #

∀ {α : Type u} (s s_1 : Set α),
  s = s_1 →
    ∀ {inst : DecidablePred fun x ↦ x ∈ s} [inst_1 : DecidablePred fun x ↦ x ∈ s_1], PEquiv.ofSet s = PEquiv.ofSet s_1

def PEquiv.ctorIdx E1 #

{α : Type u} → {β : Type v} → (α ≃. β) → ℕ

theorem PEquiv.mk.inj E1 #

∀ {α : Type u} {β : Type v} {toFun : α → Option β} {invFun : β → Option α}
  {inv : ∀ (a : α) (b : β), invFun b = some a ↔ toFun a = some b} {toFun_1 : α → Option β} {invFun_1 : β → Option α}
  {inv_1 : ∀ (a : α) (b : β), invFun_1 b = some a ↔ toFun_1 a = some b},
  { toFun := toFun, invFun := invFun, inv := inv } = { toFun := toFun_1, invFun := invFun_1, inv := inv_1 } →
    toFun = toFun_1 ∧ invFun = invFun_1

structure PEquiv E3 #

Type u → Type v → Type (max u v)

A PEquiv is a partial equivalence, a representation of a bijection between a subset of α and a subset of β. See also PartialEquiv for a version that requires toFun and invFun to be globally defined functions and has source and target sets as extra fields.

ctor PEquiv.mk E0 #

{α : Type u} →
  {β : Type v} →
    (toFun : α → Option β) →
      (invFun : β → Option α) → (∀ (a : α) (b : β), invFun b = some a ↔ toFun a = some b) → α ≃. β

abbrev PEquiv.toFun E3 #

{α : Type u} → {β : Type v} → (α ≃. β) → α → Option β

The underlying partial function of a PEquiv

abbrev PEquiv.invFun E1 #

{α : Type u} → {β : Type v} → (α ≃. β) → β → Option α

The partial inverse of toFun

theorem PEquiv.inv E1 #

∀ {α : Type u} {β : Type v} (self : α ≃. β) (a : α) (b : β), self.invFun b = some a ↔ self.toFun a = some b

invFun is the partial inverse of toFun

def «term_≃._» E1 #

Lean.TrailingParserDescr

A PEquiv is a partial equivalence, a representation of a bijection between a subset of α and a subset of β. See also PartialEquiv for a version that requires toFun and invFun to be globally defined functions and has source and target sets as extra fields.

instance PEquiv.instFunLikeOption E0 #

{α : Type u} → {β : Type v} → FunLike (α ≃. β) α (Option β)

theorem PEquiv.coe_mk E0 #

∀ {α : Type u} {β : Type v} (f₁ : α → Option β) (f₂ : β → Option α)
  (h : ∀ (a : α) (b : β), f₂ b = some a ↔ f₁ a = some b), ⇑{ toFun := f₁, invFun := f₂, inv := h } = f₁

theorem PEquiv.coe_mk_apply E0 #

∀ {α : Type u} {β : Type v} (f₁ : α → Option β) (f₂ : β → Option α)
  (h : ∀ (a : α) (b : β), f₂ b = some a ↔ f₁ a = some b) (x : α), { toFun := f₁, invFun := f₂, inv := h } x = f₁ x

theorem PEquiv.ext_iff E0 #

∀ {α : Type u} {β : Type v} {f g : α ≃. β}, f = g ↔ ∀ (x : α), f x = g x

theorem PEquiv.ext E1 #

∀ {α : Type u} {β : Type v} {f g : α ≃. β}, (∀ (x : α), f x = g x) → f = g

def PEquiv.refl E1 #

(α : Type u_1) → α ≃. α

The identity map as a partial equivalence.

def PEquiv.symm E1 #

{α : Type u} → {β : Type v} → (α ≃. β) → β ≃. α

The inverse partial equivalence.

theorem PEquiv.mem_iff_mem E0 #

∀ {α : Type u} {β : Type v} (f : α ≃. β) {a : α} {b : β}, a ∈ f.symm b ↔ b ∈ f a

def PEquiv.trans E1 #

{α : Type u} → {β : Type v} → {γ : Type w} → (α ≃. β) → (β ≃. γ) → α ≃. γ

Composition of partial equivalences f : α ≃. β and g : β ≃. γ.

theorem PEquiv.refl_apply E0 #

∀ {α : Type u} (a : α), (PEquiv.refl α) a = some a

theorem PEquiv.symm_refl E0 #

∀ {α : Type u}, (PEquiv.refl α).symm = PEquiv.refl α

theorem PEquiv.symm_symm E0 #

∀ {α : Type u} {β : Type v} (f : α ≃. β), f.symm.symm = f

theorem PEquiv.symm_apply_eq E0 #

∀ {α : Type u} {β : Type v} (f : α ≃. β) {x : β} {y : α}, f.symm x = some y ↔ some x = f y

theorem PEquiv.symm_bijective E1 #

∀ {α : Type u} {β : Type v}, Function.Bijective PEquiv.symm

theorem PEquiv.symm_injective E1 #

∀ {α : Type u} {β : Type v}, Function.Injective PEquiv.symm

theorem PEquiv.trans_assoc E1 #

∀ {α : Type u} {β : Type v} {γ : Type w} {δ : Type x} (f : α ≃. β) (g : β ≃. γ) (h : γ ≃. δ),
  (f.trans g).trans h = f.trans (g.trans h)

theorem PEquiv.mem_trans E0 #

∀ {α : Type u} {β : Type v} {γ : Type w} (f : α ≃. β) (g : β ≃. γ) (a : α) (c : γ),
  c ∈ (f.trans g) a ↔ ∃ b ∈ f a, c ∈ g b

theorem PEquiv.trans_eq_some E1 #

∀ {α : Type u} {β : Type v} {γ : Type w} (f : α ≃. β) (g : β ≃. γ) (a : α) (c : γ),
  (f.trans g) a = some c ↔ ∃ b, f a = some b ∧ g b = some c

theorem PEquiv.trans_eq_none E1 #

∀ {α : Type u} {β : Type v} {γ : Type w} (f : α ≃. β) (g : β ≃. γ) (a : α),
  (f.trans g) a = none ↔ ∀ (b : β) (c : γ), b ∉ f a ∨ c ∉ g b

theorem PEquiv.refl_trans E0 #

∀ {α : Type u} {β : Type v} (f : α ≃. β), (PEquiv.refl α).trans f = f

theorem PEquiv.trans_refl E0 #

∀ {α : Type u} {β : Type v} (f : α ≃. β), f.trans (PEquiv.refl β) = f

theorem PEquiv.inj E1 #

∀ {α : Type u} {β : Type v} (f : α ≃. β) {a₁ a₂ : α} {b : β}, b ∈ f a₁ → b ∈ f a₂ → a₁ = a₂

theorem PEquiv.injective_of_forall_ne_isSome E3 #

∀ {α : Type u} {β : Type v} (f : α ≃. β) (a₂ : α), (∀ (a₁ : α), a₁ ≠ a₂ → (f a₁).isSome = true) → Function.Injective ⇑f

If the domain of a PEquiv is α except a point, its forward direction is injective.

theorem PEquiv.injective_of_forall_isSome E3 #

∀ {α : Type u} {β : Type v} {f : α ≃. β}, (∀ (a : α), (f a).isSome = true) → Function.Injective ⇑f

If the domain of a PEquiv is all of α, its forward direction is injective.

def PEquiv.ofSet E3 #

{α : Type u} → (s : Set α) → [DecidablePred fun x ↦ x ∈ s] → α ≃. α

Creates a PEquiv that is the identity on s, and none outside of it.

theorem PEquiv.mem_ofSet_self_iff E0 #

∀ {α : Type u} {s : Set α} [inst : DecidablePred fun x ↦ x ∈ s] {a : α}, a ∈ (PEquiv.ofSet s) a ↔ a ∈ s

theorem PEquiv.mem_ofSet_iff E0 #

∀ {α : Type u} {s : Set α} [inst : DecidablePred fun x ↦ x ∈ s] {a b : α}, a ∈ (PEquiv.ofSet s) b ↔ a = b ∧ a ∈ s

theorem PEquiv.ofSet_eq_some_iff E0 #

∀ {α : Type u} {s : Set α} {x : DecidablePred fun x ↦ x ∈ s} {a b : α}, (PEquiv.ofSet s) b = some a ↔ a = b ∧ a ∈ s

theorem PEquiv.ofSet_eq_some_self_iff E0 #

∀ {α : Type u} {s : Set α} {x : DecidablePred fun x ↦ x ∈ s} {a : α}, (PEquiv.ofSet s) a = some a ↔ a ∈ s

theorem PEquiv.ofSet_symm E0 #

∀ {α : Type u} (s : Set α) [inst : DecidablePred fun x ↦ x ∈ s], (PEquiv.ofSet s).symm = PEquiv.ofSet s

theorem PEquiv.ofSet_univ E0 #

∀ {α : Type u}, PEquiv.ofSet Set.univ = PEquiv.refl α

theorem PEquiv.ofSet_eq_refl E0 #

∀ {α : Type u} {s : Set α} [inst : DecidablePred fun x ↦ x ∈ s], PEquiv.ofSet s = PEquiv.refl α ↔ s = Set.univ

theorem PEquiv.symm_trans_rev E1 #

∀ {α : Type u} {β : Type v} {γ : Type w} (f : α ≃. β) (g : β ≃. γ), (f.trans g).symm = g.symm.trans f.symm

theorem PEquiv.self_trans_symm E1 #

∀ {α : Type u} {β : Type v} (f : α ≃. β), f.trans f.symm = PEquiv.ofSet {a | (f a).isSome = true}

theorem PEquiv.symm_trans_self E1 #

∀ {α : Type u} {β : Type v} (f : α ≃. β), f.symm.trans f = PEquiv.ofSet {b | (f.symm b).isSome = true}

theorem PEquiv.trans_symm_eq_iff_forall_isSome E1 #

∀ {α : Type u} {β : Type v} {f : α ≃. β}, f.trans f.symm = PEquiv.refl α ↔ ∀ (a : α), (f a).isSome = true

instance PEquiv.instBotPEquiv E0 #

{α : Type u} → {β : Type v} → Bot (α ≃. β)

instance PEquiv.instInhabited E0 #

{α : Type u} → {β : Type v} → Inhabited (α ≃. β)

theorem PEquiv.bot_apply E0 #

∀ {α : Type u} {β : Type v} (a : α), ⊥ a = none

theorem PEquiv.symm_bot E0 #

∀ {α : Type u} {β : Type v}, ⊥.symm = ⊥

theorem PEquiv.trans_bot E0 #

∀ {α : Type u} {β : Type v} {γ : Type w} (f : α ≃. β), f.trans ⊥ = ⊥

theorem PEquiv.bot_trans E0 #

∀ {α : Type u} {β : Type v} {γ : Type w} (f : β ≃. γ), ⊥.trans f = ⊥

theorem PEquiv.isSome_symm_get E1 #

∀ {α : Type u} {β : Type v} (f : α ≃. β) {a : α} (h : (f a).isSome = true), (f.symm ((f a).get h)).isSome = true

def PEquiv.single E3 #

{α : Type u} → {β : Type v} → [DecidableEq α] → [DecidableEq β] → α → β → α ≃. β

Create a PEquiv which sends a to b and b to a, but is otherwise none.

theorem PEquiv.mem_single E0 #

∀ {α : Type u} {β : Type v} [inst : DecidableEq α] [inst_1 : DecidableEq β] (a : α) (b : β), b ∈ (PEquiv.single a b) a

theorem PEquiv.mem_single_iff E0 #

∀ {α : Type u} {β : Type v} [inst : DecidableEq α] [inst_1 : DecidableEq β] (a₁ a₂ : α) (b₁ b₂ : β),
  b₁ ∈ (PEquiv.single a₂ b₂) a₁ ↔ a₁ = a₂ ∧ b₁ = b₂

theorem PEquiv.symm_single E0 #

∀ {α : Type u} {β : Type v} [inst : DecidableEq α] [inst_1 : DecidableEq β] (a : α) (b : β),
  (PEquiv.single a b).symm = PEquiv.single b a

theorem PEquiv.single_apply E0 #

∀ {α : Type u} {β : Type v} [inst : DecidableEq α] [inst_1 : DecidableEq β] (a : α) (b : β),
  (PEquiv.single a b) a = some b

theorem PEquiv.single_apply_of_ne E1 #

∀ {α : Type u} {β : Type v} [inst : DecidableEq α] [inst_1 : DecidableEq β] {a₁ a₂ : α},
  a₁ ≠ a₂ → ∀ (b : β), (PEquiv.single a₁ b) a₂ = none

theorem PEquiv.single_trans_of_mem E1 #

∀ {α : Type u} {β : Type v} {γ : Type w} [inst : DecidableEq α] [inst_1 : DecidableEq β] [inst_2 : DecidableEq γ]
  (a : α) {b : β} {c : γ} {f : β ≃. γ}, c ∈ f b → (PEquiv.single a b).trans f = PEquiv.single a c

theorem PEquiv.trans_single_of_mem E1 #

∀ {α : Type u} {β : Type v} {γ : Type w} [inst : DecidableEq α] [inst_1 : DecidableEq β] [inst_2 : DecidableEq γ]
  {a : α} {b : β} (c : γ) {f : α ≃. β}, b ∈ f a → f.trans (PEquiv.single b c) = PEquiv.single a c

theorem PEquiv.single_trans_single E0 #

∀ {α : Type u} {β : Type v} {γ : Type w} [inst : DecidableEq α] [inst_1 : DecidableEq β] [inst_2 : DecidableEq γ]
  (a : α) (b : β) (c : γ), (PEquiv.single a b).trans (PEquiv.single b c) = PEquiv.single a c

theorem PEquiv.single_subsingleton_eq_refl E0 #

∀ {α : Type u} [inst : DecidableEq α] [Subsingleton α] (a b : α), PEquiv.single a b = PEquiv.refl α

theorem PEquiv.trans_single_of_eq_none E1 #

∀ {β : Type v} {γ : Type w} {δ : Type x} [inst : DecidableEq β] [inst_1 : DecidableEq γ] {b : β} (c : γ) {f : δ ≃. β},
  f.symm b = none → f.trans (PEquiv.single b c) = ⊥

theorem PEquiv.single_trans_of_eq_none E1 #

∀ {α : Type u} {β : Type v} {δ : Type x} [inst : DecidableEq α] [inst_1 : DecidableEq β] (a : α) {b : β} {f : β ≃. δ},
  f b = none → (PEquiv.single a b).trans f = ⊥

theorem PEquiv.single_trans_single_of_ne E1 #

∀ {α : Type u} {β : Type v} {γ : Type w} [inst : DecidableEq α] [inst_1 : DecidableEq β] [inst_2 : DecidableEq γ]
  {b₁ b₂ : β}, b₁ ≠ b₂ → ∀ (a : α) (c : γ), (PEquiv.single a b₁).trans (PEquiv.single b₂ c) = ⊥

instance PEquiv.instPartialOrderPEquiv E0 #

{α : Type u} → {β : Type v} → PartialOrder (α ≃. β)

theorem PEquiv.le_def E0 #

∀ {α : Type u} {β : Type v} {f g : α ≃. β}, f ≤ g ↔ ∀ (a : α), ∀ b ∈ f a, b ∈ g a

instance PEquiv.instOrderBot E0 #

{α : Type u} → {β : Type v} → OrderBot (α ≃. β)

instance PEquiv.instSemilatticeInfOfDecidableEq E0 #

{α : Type u} → {β : Type v} → [DecidableEq α] → [DecidableEq β] → SemilatticeInf (α ≃. β)

def Equiv.toPEquiv E1 #

{α : Type u_1} → {β : Type u_2} → α ≃ β → α ≃. β

Turns an Equiv into a PEquiv of the whole type.

theorem Equiv.toPEquiv_refl E0 #

∀ {α : Type u_1}, (Equiv.refl α).toPEquiv = PEquiv.refl α

theorem Equiv.toPEquiv_trans E1 #

∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} (f : α ≃ β) (g : β ≃ γ),
  (f.trans g).toPEquiv = f.toPEquiv.trans g.toPEquiv

theorem Equiv.toPEquiv_symm E1 #

∀ {α : Type u_1} {β : Type u_2} (f : α ≃ β), f.symm.toPEquiv = f.toPEquiv.symm

theorem Equiv.toPEquiv_apply E0 #

∀ {α : Type u_1} {β : Type u_2} (f : α ≃ β) (x : α), f.toPEquiv x = some (f x)