/-
Copyright (c) 2021 Eric Rodriguez. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Eric Rodriguez
-/
module
public import Mathlib.Logic.Embedding.Set
set_option doc.verso true
set_option doc.verso.suggestions false
/-!
# Equivalences on embeddings
This file shows some advanced equivalences on embeddings, useful for constructing larger
embeddings from smaller ones.
-/
@[expose] public section
open Function.Embedding
namespace Equiv
/-- Embeddings from a sum type are equivalent to two separate embeddings with disjoint ranges. -/
def sumEmbeddingEquivProdEmbeddingDisjoint {α β γ : Type*} :
(α ⊕ β ↪ γ) ≃ { f : (α ↪ γ) × (β ↪ γ) // Disjoint (Set.range f.1) (Set.range f.2) } where
toFun f :=
⟨(inl.trans f, inr.trans f), by
rw [Set.disjoint_left]
rintro _ ⟨a, h⟩ ⟨b, rfl⟩
simp only at h
have : Sum.inl a = Sum.inr b := f.injective h
simp only [reduceCtorEq] at this⟩
invFun := fun ⟨⟨f, g⟩, disj⟩ =>
⟨fun x =>
match x with
| Sum.inl a => f a
| Sum.inr b => g b, by
rintro (a₁ | b₁) (a₂ | b₂) f_eq <;>
simp only at f_eq
· rw [f.injective f_eq]
· exfalso
exact disj.le_bot ⟨⟨a₁, f_eq⟩, ⟨b₂, by simp⟩⟩
· exfalso
exact disj.le_bot ⟨⟨a₂, rfl⟩, ⟨b₁, f_eq⟩⟩
· rw [g.injective f_eq]⟩
left_inv f := by
dsimp only
ext x
cases x <;> simp!
right_inv := fun ⟨⟨f, g⟩, _⟩ => by
simp only
rfl
/-- Embeddings whose range lies within a set are equivalent to embeddings to that set.
This is `Function.Embedding.codRestrict` as an equiv. -/
def codRestrict (α : Type*) {β : Type*} (bs : Set β) :
{ f : α ↪ β // ∀ a, f a ∈ bs } ≃
(α ↪ bs) where
toFun f := (f : α ↪ β).codRestrict bs f.prop
invFun f := ⟨f.trans (Function.Embedding.subtype _), fun a => (f a).prop⟩
/-- Pairs of embeddings with disjoint ranges are equivalent to a dependent sum of embeddings,
in which the second embedding cannot take values in the range of the first. -/
def prodEmbeddingDisjointEquivSigmaEmbeddingRestricted {α β γ : Type*} :
{ f : (α ↪ γ) × (β ↪ γ) // Disjoint (Set.range f.1) (Set.range f.2) } ≃
Σ f : α ↪ γ, β ↪ ↥(Set.range f)ᶜ :=
(subtypeProdEquivSigmaSubtype fun (a : α ↪ γ) (b : β ↪ _) =>
Disjoint (Set.range a) (Set.range b)).trans <|
Equiv.sigmaCongrRight fun a =>
(subtypeEquivProp <| by
ext f
rw [← Set.range_subset_iff, Set.subset_compl_iff_disjoint_right, disjoint_comm]).trans
(codRestrict _ _)
/-- A combination of the above results, allowing us to turn one embedding over a sum type
into two dependent embeddings, the second of which avoids any members of the range
of the first. This is helpful for constructing larger embeddings out of smaller ones. -/
def sumEmbeddingEquivSigmaEmbeddingRestricted {α β γ : Type*} :
(α ⊕ β ↪ γ) ≃ Σ f : α ↪ γ, β ↪ ↥(Set.range f)ᶜ :=
Equiv.trans sumEmbeddingEquivProdEmbeddingDisjoint
prodEmbeddingDisjointEquivSigmaEmbeddingRestricted
@[deprecated (since := "2026-11-02")] alias uniqueEmbeddingEquivResult := embeddingUnique
end Equiv
¤ Dauer der Verarbeitung: 0.0 Sekunden
(vorverarbeitet am 2026-11-24)
¤
*© Formatika GbR, Deutschland