Relation homomorphisms, embeddings, isomorphisms #
This file defines relation homomorphisms, embeddings, isomorphisms and order embeddings and isomorphisms.
Main declarations #
RelHom
: Relation homomorphism. ARelHom r s
is a functionf : α → β
such thatr a b → s (f a) (f b)
.RelEmbedding
: Relation embedding. ARelEmbedding r s
is an embeddingf : α ↪ β
such thatr a b ↔ s (f a) (f b)
.RelIso
: Relation isomorphism. ARelIso r s
is an equivalencef : α ≃ β
such thatr a b ↔ s (f a) (f b)
.sumLexCongr
,prodLexCongr
: Creates a relation homomorphism between twoSum.Lex
or twoProd.Lex
from relation homomorphisms between their arguments.
Notation #
→r
:RelHom
↪r
:RelEmbedding
≃r
:RelIso
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)
.
- toFun : α → β
The underlying function of a
RelHom
- map_rel' : ∀ {a b : α}, r a b → s (self.toFun a) (self.toFun b)
A
RelHom
sends related elements to related elements
Instances For
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)
.
Equations
- «term_→r_» = Lean.ParserDescr.trailingNode `term_→r_ 25 25 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " →r ") (Lean.ParserDescr.cat `term 26))
Instances For
RelHomClass 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 outParam
s since figuring them out from a goal is a higher-order
matching problem that Lean usually can't do unaided.
- map_rel : ∀ (f : F) {a b : α}, r a b → s (f a) (f b)
A
RelHomClass
sends related elements to related elements
Instances
Equations
- ⋯ = ⋯
The map coe_fn : (r →r s) → (α → β)
is injective.
Composition of two relation homomorphisms is a relation homomorphism.
Equations
- RelHom.comp g f = { toFun := fun (x : α) => g (f x), map_rel' := ⋯ }
Instances For
A relation homomorphism is also a relation homomorphism between dual relations.
Equations
- RelHom.swap f = { toFun := ⇑f, map_rel' := ⋯ }
Instances For
A function is a relation homomorphism from the preimage relation of s
to s
.
Equations
- RelHom.preimage f s = { toFun := f, map_rel' := ⋯ }
Instances For
An increasing function is injective
An increasing function is injective
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)
.
- toFun : α → β
- inj' : Function.Injective self.toFun
- map_rel_iff' : ∀ {a b : α}, s (self.toEmbedding a) (self.toEmbedding b) ↔ r a b
Elements are related iff they are related after apply a
RelEmbedding
Instances For
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)
.
Equations
- «term_↪r_» = Lean.ParserDescr.trailingNode `term_↪r_ 25 25 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " ↪r ") (Lean.ParserDescr.cat `term 26))
Instances For
The induced relation on a subtype is an embedding under the natural inclusion.
Equations
- Subtype.relEmbedding r p = { toEmbedding := Function.Embedding.subtype p, map_rel_iff' := ⋯ }
Instances For
A relation embedding is also a relation homomorphism
Equations
- RelEmbedding.toRelHom f = { toFun := f.toFun, map_rel' := ⋯ }
Instances For
Equations
- ⋯ = ⋯
Equations
- ⋯ = ⋯
The map coe_fn : (r ↪r s) → (α → β)
is injective.
Identity map is a relation embedding.
Equations
- RelEmbedding.refl r = { toEmbedding := Function.Embedding.refl α, map_rel_iff' := ⋯ }
Instances For
Composition of two relation embeddings is a relation embedding.
Equations
- RelEmbedding.trans f g = { toEmbedding := Function.Embedding.trans f.toEmbedding g.toEmbedding, map_rel_iff' := ⋯ }
Instances For
Equations
- RelEmbedding.instInhabitedRelEmbedding r = { default := RelEmbedding.refl r }
A relation embedding is also a relation embedding between dual relations.
Equations
- RelEmbedding.swap f = { toEmbedding := f.toEmbedding, map_rel_iff' := ⋯ }
Instances For
If f
is injective, then it is a relation embedding from the
preimage relation of s
to s
.
Equations
- RelEmbedding.preimage f s = { toEmbedding := f, map_rel_iff' := ⋯ }
Instances For
Equations
- ⋯ = ⋯
Equations
- ⋯ = ⋯
Quotient.mk'
as a relation homomorphism between the relation and the lift of a relation.
Equations
- Quotient.mkRelHom H = { toFun := Quotient.mk', map_rel' := ⋯ }
Instances For
Quotient.out
as a relation embedding between the lift of a relation and the relation.
Equations
- Quotient.outRelEmbedding H = { toEmbedding := Function.Embedding.quotientOut α, map_rel_iff' := ⋯ }
Instances For
Quotient.out'
as a relation embedding between the lift of a relation and the relation.
Equations
- Quotient.out'RelEmbedding H = let __src := Quotient.outRelEmbedding H; { toEmbedding := { toFun := Quotient.out', inj' := ⋯ }, map_rel_iff' := ⋯ }
Instances For
A relation is well founded iff its lift to a quotient is.
Alias of the reverse direction of wellFounded_lift₂_iff
.
A relation is well founded iff its lift to a quotient is.
Alias of the forward direction of wellFounded_lift₂_iff
.
A relation is well founded iff its lift to a quotient is.
Alias of the forward direction of wellFounded_liftOn₂'_iff
.
Alias of the reverse direction of wellFounded_liftOn₂'_iff
.
To define a 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
- RelEmbedding.ofMapRelIff f hf = { toEmbedding := { toFun := f, inj' := ⋯ }, map_rel_iff' := ⋯ }
Instances For
It suffices to prove f
is monotone between strict relations
to show it is a relation embedding.
Equations
- RelEmbedding.ofMonotone f H = { toEmbedding := { toFun := f, inj' := ⋯ }, map_rel_iff' := ⋯ }
Instances For
A relation embedding from an empty type.
Equations
- RelEmbedding.ofIsEmpty r s = { toEmbedding := Function.Embedding.ofIsEmpty, map_rel_iff' := ⋯ }
Instances For
Sum.inl
as a relation embedding into Sum.LiftRel r s
.
Equations
- RelEmbedding.sumLiftRelInl r s = { toEmbedding := { toFun := Sum.inl, inj' := ⋯ }, map_rel_iff' := ⋯ }
Instances For
Sum.inr
as a relation embedding into Sum.LiftRel r s
.
Equations
- RelEmbedding.sumLiftRelInr r s = { toEmbedding := { toFun := Sum.inr, inj' := ⋯ }, map_rel_iff' := ⋯ }
Instances For
Sum.map
as a relation embedding between Sum.LiftRel
relations.
Equations
- RelEmbedding.sumLiftRelMap f g = { toEmbedding := { toFun := Sum.map ⇑f ⇑g, inj' := ⋯ }, map_rel_iff' := ⋯ }
Instances For
Sum.map
as a relation embedding between Sum.Lex
relations.
Equations
- RelEmbedding.sumLexMap f g = { toEmbedding := { toFun := Sum.map ⇑f ⇑g, inj' := ⋯ }, map_rel_iff' := ⋯ }
Instances For
fun b ↦ Prod.mk a b
as a relation embedding.
Equations
- RelEmbedding.prodLexMkLeft s h = { toEmbedding := { toFun := Prod.mk a, inj' := ⋯ }, map_rel_iff' := ⋯ }
Instances For
fun a ↦ Prod.mk a b
as a relation embedding.
Equations
- RelEmbedding.prodLexMkRight r h = { toEmbedding := { toFun := fun (a : α) => (a, b), inj' := ⋯ }, map_rel_iff' := ⋯ }
Instances For
Prod.map
as a relation embedding.
Equations
- RelEmbedding.prodLexMap f g = { toEmbedding := { toFun := Prod.map ⇑f ⇑g, inj' := ⋯ }, map_rel_iff' := ⋯ }
Instances For
A relation isomorphism is an equivalence that is also a relation embedding.
- toFun : α → β
- invFun : β → α
- left_inv : Function.LeftInverse self.invFun self.toFun
- right_inv : Function.RightInverse self.invFun self.toFun
- map_rel_iff' : ∀ {a b : α}, s (self.toEquiv a) (self.toEquiv b) ↔ r a b
Elements are related iff they are related after apply a
RelIso
Instances For
A relation isomorphism is an equivalence that is also a relation embedding.
Equations
- «term_≃r_» = Lean.ParserDescr.trailingNode `term_≃r_ 25 25 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " ≃r ") (Lean.ParserDescr.cat `term 26))
Instances For
Convert a RelIso
to a RelEmbedding
. This function is also available as a coercion
but often it is easier to write f.toRelEmbedding
than to write explicitly r
and s
in the target type.
Equations
- RelIso.toRelEmbedding f = { toEmbedding := Equiv.toEmbedding f.toEquiv, map_rel_iff' := ⋯ }
Instances For
Equations
- ⋯ = ⋯
The map coe_fn : (r ≃r s) → (α → β)
is injective. Lean fails to parse
function.injective (fun e : r ≃r s ↦ (e : α → β))
, so we use a trick to say the same.
Inverse map of a relation isomorphism is a relation isomorphism.
Equations
- RelIso.symm f = { toEquiv := f.symm, map_rel_iff' := ⋯ }
Instances For
See Note [custom simps projection]. We need to specify this projection explicitly in this case,
because RelIso
defines custom coercions other than the ones given by DFunLike
.
Equations
- RelIso.Simps.apply h = ⇑h
Instances For
See Note [custom simps projection].
Equations
- RelIso.Simps.symm_apply h = ⇑(RelIso.symm h)
Instances For
Identity map is a relation isomorphism.
Equations
- RelIso.refl r = { toEquiv := Equiv.refl α, map_rel_iff' := ⋯ }
Instances For
Composition of two relation isomorphisms is a relation isomorphism.
Equations
- RelIso.trans f₁ f₂ = { toEquiv := f₁.trans f₂.toEquiv, map_rel_iff' := ⋯ }
Instances For
Equations
- RelIso.instInhabitedRelIso r = { default := RelIso.refl r }
A relation isomorphism between equal relations on equal types.
Equations
- RelIso.cast h₁ h₂ = { toEquiv := Equiv.cast h₁, map_rel_iff' := ⋯ }
Instances For
a relation isomorphism is also a relation isomorphism between dual relations.
Equations
- RelIso.swap f = { toEquiv := f.toEquiv, map_rel_iff' := ⋯ }
Instances For
Any equivalence lifts to a relation isomorphism between s
and its preimage.
Equations
- RelIso.preimage f s = { toEquiv := f, map_rel_iff' := ⋯ }
Instances For
Equations
- ⋯ = ⋯
Equations
- ⋯ = ⋯
A surjective relation embedding is a relation isomorphism.
Equations
- RelIso.ofSurjective f H = { toEquiv := Equiv.ofBijective ⇑f ⋯, map_rel_iff' := ⋯ }
Instances For
Given relation isomorphisms r₁ ≃r s₁
and r₂ ≃r s₂
, construct a relation isomorphism for the
lexicographic orders on the sum.
Equations
- RelIso.sumLexCongr e₁ e₂ = { toEquiv := Equiv.sumCongr e₁.toEquiv e₂.toEquiv, map_rel_iff' := ⋯ }
Instances For
Given relation isomorphisms r₁ ≃r s₁
and r₂ ≃r s₂
, construct a relation isomorphism for the
lexicographic orders on the product.
Equations
- RelIso.prodLexCongr e₁ e₂ = { toEquiv := Equiv.prodCongr e₁.toEquiv e₂.toEquiv, map_rel_iff' := ⋯ }
Instances For
Two relations on empty types are isomorphic.
Equations
- RelIso.relIsoOfIsEmpty r s = { toEquiv := Equiv.equivOfIsEmpty α β, map_rel_iff' := ⋯ }
Instances For
Two irreflexive relations on a unique type are isomorphic.
Equations
- RelIso.relIsoOfUniqueOfIrrefl r s = { toEquiv := Equiv.equivOfUnique α β, map_rel_iff' := ⋯ }
Instances For
Two reflexive relations on a unique type are isomorphic.
Equations
- RelIso.relIsoOfUniqueOfRefl r s = { toEquiv := Equiv.equivOfUnique α β, map_rel_iff' := ⋯ }