Relation homomorphisms, embeddings, isomorphisms #
THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.
This file defines relation homomorphisms, embeddings, isomorphisms and order embeddings and isomorphisms.
Main declarations #
rel_hom
: Relation homomorphism. Arel_hom r s
is a functionf : α → β
such thatr a b → s (f a) (f b)
.rel_embedding
: Relation embedding. Arel_embedding r s
is an embeddingf : α ↪ β
such thatr a b ↔ s (f a) (f b)
.rel_iso
: Relation isomorphism. Arel_iso r s
is an equivalencef : α ≃ β
such thatr a b ↔ s (f a) (f b)
.sum_lex_congr
,prod_lex_congr
: Creates a relation homomorphism between twosum_lex
or twoprod_lex
from relation homomorphisms between their arguments.
Notation #
→r
:rel_hom
↪r
:rel_embedding
≃r
:rel_iso
A relation homomorphism with respect to a given pair of relations r
and s
is a function f : α → β
such that r a b → s (f a) (f b)
.
Instances for rel_hom
- rel_hom.has_sizeof_inst
- rel_hom.rel_hom_class
- rel_hom.has_coe_to_fun
- rel_embedding.rel_hom.has_coe
- coe : F → Π (a : α), (λ (_x : α), β) a
- coe_injective' : function.injective rel_hom_class.coe
- map_rel : ∀ (f : F) {a b : α}, r a b → s (⇑f a) (⇑f b)
rel_hom_class F r s
asserts that F
is a type of functions such that all f : F
satisfy r a b → s (f a) (f b)
.
The relations r
and s
are out_param
s since figuring them out from a goal is a higher-order
matching problem that Lean usually can't do unaided.
Instances of this typeclass
Instances of other typeclasses for rel_hom_class
- rel_hom_class.has_sizeof_inst
Equations
- rel_hom.rel_hom_class = {coe := λ (o : r →r s), o.to_fun, coe_injective' := _, map_rel := _}
An increasing function is injective
- to_embedding : α ↪ β
- map_rel_iff' : ∀ {a b : α}, s (⇑(self.to_embedding) a) (⇑(self.to_embedding) b) ↔ r a b
A relation embedding with respect to a given pair of relations r
and s
is an embedding f : α ↪ β
such that r a b ↔ s (f a) (f b)
.
Instances for rel_embedding
The induced relation on a subtype is an embedding under the natural inclusion.
Equations
- subtype.rel_embedding r p = {to_embedding := function.embedding.subtype p, map_rel_iff' := _}
Equations
- rel_embedding.has_coe_to_fun = {coe := λ (o : r ↪r s), ⇑(o.to_embedding)}
Equations
- rel_embedding.rel_hom_class = {coe := coe_fn rel_embedding.has_coe_to_fun, coe_injective' := _, map_rel := _}
See Note [custom simps projection]. We need to specify this projection explicitly in this case, because it is a composition of multiple projections.
Equations
Identity map is a relation embedding.
Equations
- rel_embedding.refl r = {to_embedding := function.embedding.refl α, map_rel_iff' := _}
Composition of two relation embeddings is a relation embedding.
Equations
- f.trans g = {to_embedding := f.to_embedding.trans g.to_embedding, map_rel_iff' := _}
Equations
A relation embedding is also a relation embedding between dual relations.
Equations
- f.swap = {to_embedding := f.to_embedding, map_rel_iff' := _}
If f
is injective, then it is a relation embedding from the
preimage relation of s
to s
.
Equations
- rel_embedding.preimage f s = {to_embedding := f, map_rel_iff' := _}
quotient.mk
as a relation homomorphism between the relation and the lift of a relation.
Equations
- quotient.mk_rel_hom H = {to_fun := quotient.mk _inst_1, map_rel' := _}
quotient.out
as a relation embedding between the lift of a relation and the relation.
Equations
- quotient.out_rel_embedding H = {to_embedding := function.embedding.quotient_out α _inst_1, map_rel_iff' := _}
quotient.out'
as a relation embedding between the lift of a relation and the relation.
Equations
- quotient.out'_rel_embedding H = {to_embedding := {to_fun := quotient.out' s, inj' := _}, map_rel_iff' := _}
A relation is well founded iff its lift to a quotient is.
Alias of the forward direction of well_founded_lift₂_iff
.
Alias of the reverse direction of well_founded_lift₂_iff
.
Alias of the forward direction of well_founded_lift_on₂'_iff
.
Alias of the reverse direction of well_founded_lift_on₂'_iff
.
To define an relation embedding from an antisymmetric relation r
to a reflexive relation s
it
suffices to give a function together with a proof that it satisfies s (f a) (f b) ↔ r a b
.
Equations
- rel_embedding.of_map_rel_iff f hf = {to_embedding := {to_fun := f, inj' := _}, map_rel_iff' := hf}
It suffices to prove f
is monotone between strict relations
to show it is a relation embedding.
Equations
- rel_embedding.of_monotone f H = {to_embedding := {to_fun := f, inj' := _}, map_rel_iff' := _}
A relation embedding from an empty type.
Equations
- rel_embedding.of_is_empty r s = {to_embedding := function.embedding.of_is_empty _inst_1, map_rel_iff' := _}
sum.inl
as a relation embedding into sum.lift_rel r s
.
Equations
- rel_embedding.sum_lift_rel_inl r s = {to_embedding := {to_fun := sum.inl β, inj' := _}, map_rel_iff' := _}
sum.inr
as a relation embedding into sum.lift_rel r s
.
Equations
- rel_embedding.sum_lift_rel_inr r s = {to_embedding := {to_fun := sum.inr β, inj' := _}, map_rel_iff' := _}
sum.map
as a relation embedding between sum.lift_rel
relations.
Equations
- f.sum_lift_rel_map g = {to_embedding := {to_fun := sum.map ⇑f ⇑g, inj' := _}, map_rel_iff' := _}
sum.map
as a relation embedding between sum.lex
relations.
Equations
- f.sum_lex_map g = {to_embedding := {to_fun := sum.map ⇑f ⇑g, inj' := _}, map_rel_iff' := _}
λ b, prod.mk a b
as a relation embedding.
Equations
- rel_embedding.prod_lex_mk_left s h = {to_embedding := {to_fun := prod.mk a, inj' := _}, map_rel_iff' := _}
λ a, prod.mk a b
as a relation embedding.
Equations
- rel_embedding.prod_lex_mk_right r h = {to_embedding := {to_fun := λ (a : α), (a, b), inj' := _}, map_rel_iff' := _}
prod.map
as a relation embedding.
Equations
- f.prod_lex_map g = {to_embedding := {to_fun := prod.map ⇑f ⇑g, inj' := _}, map_rel_iff' := _}
Convert an rel_iso
to an rel_embedding
. This function is also available as a coercion
but often it is easier to write f.to_rel_embedding
than to write explicitly r
and s
in the target type.
Equations
- f.to_rel_embedding = {to_embedding := f.to_equiv.to_embedding, map_rel_iff' := _}
Equations
- rel_iso.rel_hom_class = {coe := coe_fn rel_iso.has_coe_to_fun, coe_injective' := _, map_rel := _}
The map coe_fn : (r ≃r s) → (α → β)
is injective. Lean fails to parse
function.injective (λ e : r ≃r s, (e : α → β))
, so we use a trick to say the same.
See Note [custom simps projection]. We need to specify this projection explicitly in this case, because it is a composition of multiple projections.
Equations
See Note [custom simps projection].
Equations
- rel_iso.simps.symm_apply h = ⇑(h.symm)
Identity map is a relation isomorphism.
Equations
- rel_iso.refl r = {to_equiv := equiv.refl α, map_rel_iff' := _}
Equations
- rel_iso.inhabited r = {default := rel_iso.refl r}
A relation isomorphism between equal relations on equal types.
Equations
- rel_iso.cast h₁ h₂ = {to_equiv := equiv.cast h₁, map_rel_iff' := _}
Any equivalence lifts to a relation isomorphism between s
and its preimage.
Equations
- rel_iso.preimage f s = {to_equiv := f, map_rel_iff' := _}
A surjective relation embedding is a relation isomorphism.
Equations
- rel_iso.of_surjective f H = {to_equiv := equiv.of_bijective ⇑f _, map_rel_iff' := _}
Given relation isomorphisms r₁ ≃r s₁
and r₂ ≃r s₂
, construct a relation isomorphism for the
lexicographic orders on the sum.
Equations
- e₁.sum_lex_congr e₂ = {to_equiv := e₁.to_equiv.sum_congr e₂.to_equiv, map_rel_iff' := _}
Given relation isomorphisms r₁ ≃r s₁
and r₂ ≃r s₂
, construct a relation isomorphism for the
lexicographic orders on the product.
Equations
- e₁.prod_lex_congr e₂ = {to_equiv := e₁.to_equiv.prod_congr e₂.to_equiv, map_rel_iff' := _}
Two relations on empty types are isomorphic.
Equations
- rel_iso.rel_iso_of_is_empty r s = {to_equiv := equiv.equiv_of_is_empty α β _inst_2, map_rel_iff' := _}
Two irreflexive relations on a unique type are isomorphic.
Equations
- rel_iso.rel_iso_of_unique_of_irrefl r s = {to_equiv := equiv.equiv_of_unique α β _inst_4, map_rel_iff' := _}
Two reflexive relations on a unique type are isomorphic.
Equations
- rel_iso.rel_iso_of_unique_of_refl r s = {to_equiv := equiv.equiv_of_unique α β _inst_4, map_rel_iff' := _}