Relation homomorphisms, embeddings, isomorphisms #
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)
.
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.
Equations
- rel_hom.rel_hom_class = {to_fun_like := {coe := λ (o : r →r s), o.to_fun, coe_injective' := _}, map_rel := _}
Auxiliary instance if rel_hom_class.to_fun_like.to_has_coe_to_fun
isn't found
The map coe_fn : (r →r s) → (α → β)
is injective.
Identity map is a relation homomorphism.
Equations
- rel_hom.id r = {to_fun := λ (x : α), x, map_rel' := _}
Composition of two relation homomorphisms is a relation homomorphism.
A relation homomorphism is also a relation homomorphism between dual relations.
A function is a relation homomorphism from the preimage relation of s
to s
.
Equations
- rel_hom.preimage f s = {to_fun := f, map_rel' := _}
An increasing function is injective
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)
.
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' := _}
A relation embedding is also a relation homomorphism
Equations
- f.to_rel_hom = {to_fun := f.to_embedding.to_fun, map_rel' := _}
Equations
Equations
- rel_embedding.has_coe_to_fun = {coe := λ (o : r ↪r s), ⇑(o.to_embedding)}
Equations
- rel_embedding.rel_hom_class = {to_fun_like := {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
The map coe_fn : (r ↪r s) → (α → β)
is injective.
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' := _}
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' := _}
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
Equations
- rel_iso.rel_hom_class = {to_fun_like := {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' := _}
Composition of two relation isomorphisms is a relation isomorphism.
Equations
- rel_iso.inhabited r = {default := rel_iso.refl r}
a relation isomorphism is also a relation isomorphism between dual relations.
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' := _}
Equations
- rel_iso.group = {mul := λ (f₁ f₂ : r ≃r r), f₂.trans f₁, mul_assoc := _, one := rel_iso.refl r, one_mul := _, mul_one := _, npow := div_inv_monoid.npow._default (rel_iso.refl r) (λ (f₁ f₂ : r ≃r r), f₂.trans f₁) rel_iso.group._proof_4 rel_iso.group._proof_5, npow_zero' := _, npow_succ' := _, inv := rel_iso.symm r, div := div_inv_monoid.div._default (λ (f₁ f₂ : r ≃r r), f₂.trans f₁) rel_iso.group._proof_8 (rel_iso.refl r) rel_iso.group._proof_9 rel_iso.group._proof_10 (div_inv_monoid.npow._default (rel_iso.refl r) (λ (f₁ f₂ : r ≃r r), f₂.trans f₁) rel_iso.group._proof_4 rel_iso.group._proof_5) rel_iso.group._proof_11 rel_iso.group._proof_12 rel_iso.symm, div_eq_mul_inv := _, zpow := div_inv_monoid.zpow._default (λ (f₁ f₂ : r ≃r r), f₂.trans f₁) rel_iso.group._proof_14 (rel_iso.refl r) rel_iso.group._proof_15 rel_iso.group._proof_16 (div_inv_monoid.npow._default (rel_iso.refl r) (λ (f₁ f₂ : r ≃r r), f₂.trans f₁) rel_iso.group._proof_4 rel_iso.group._proof_5) rel_iso.group._proof_17 rel_iso.group._proof_18 rel_iso.symm, zpow_zero' := _, zpow_succ' := _, zpow_neg' := _, mul_left_inv := _}
The relation embedding from the inherited relation on a subset.
Equations
- subrel.rel_embedding r p = {to_embedding := function.embedding.subtype (λ (x : α), x ∈ p), map_rel_iff' := _}
Restrict the codomain of a relation embedding.
Equations
- rel_embedding.cod_restrict p f H = {to_embedding := function.embedding.cod_restrict p f.to_embedding H, map_rel_iff' := _}