|
| 1 | +(** This file implements algebra congruence relation. It serves as a |
| 2 | + universal algebra generalization of normal subgroup, ring ideal, etc. |
| 3 | +
|
| 4 | + Congruence is used to construct quotients, in similarity with how |
| 5 | + normal subgroup and ring ideal is used to construct quotients. *) |
| 6 | + |
| 7 | +Require Export HoTT.Algebra.Universal.Algebra. |
| 8 | + |
| 9 | +Require Import |
| 10 | + HoTT.Basics |
| 11 | + HoTT.Types |
| 12 | + HoTT.HProp |
| 13 | + HoTT.Classes.interfaces.canonical_names |
| 14 | + HoTT.Algebra.Universal.Homomorphism. |
| 15 | + |
| 16 | +Unset Elimination Schemes. |
| 17 | + |
| 18 | +Import notations_algebra. |
| 19 | + |
| 20 | +Section congruence. |
| 21 | + Context {σ : Signature} (A : Algebra σ) (Φ : forall s, Relation (A s)). |
| 22 | + |
| 23 | +(** A finitary operation [f : A s1 * A s2 * ... * A sn -> A t] |
| 24 | + satisfies [OpCompatible f] iff |
| 25 | +
|
| 26 | + << |
| 27 | + Φ s1 x1 y1 * Φ s2 x2 y2 * ... * Φ sn xn yn |
| 28 | + >> |
| 29 | +
|
| 30 | + implies |
| 31 | +
|
| 32 | + << |
| 33 | + Φ t (f (x1, x2, ..., xn)) (f (y1, y2, ..., yn)). |
| 34 | + >> |
| 35 | +
|
| 36 | + The below definition generalizes this to infinitary operations. |
| 37 | +*) |
| 38 | + |
| 39 | + Definition OpCompatible {w : SymbolType σ} (f : Operation A w) : Type |
| 40 | + := forall (a b : DomOperation A w), |
| 41 | + (forall i : Arity w, Φ (sorts_dom w i) (a i) (b i)) -> |
| 42 | + Φ (sort_cod w) (f a) (f b). |
| 43 | + |
| 44 | + Class OpsCompatible : Type |
| 45 | + := ops_compatible : forall (u : Symbol σ), OpCompatible u.#A. |
| 46 | + |
| 47 | + Global Instance trunc_ops_compatible `{Funext} {n : trunc_index} |
| 48 | + `{!forall s x y, IsTrunc n (Φ s x y)} |
| 49 | + : IsTrunc n OpsCompatible. |
| 50 | + Proof. |
| 51 | + apply trunc_forall. |
| 52 | + Defined. |
| 53 | + |
| 54 | + (** A family of relations [Φ] is a congruence iff it is a family of |
| 55 | + mere equivalence relations and [OpsCompatible A Φ] holds. *) |
| 56 | + |
| 57 | + Class IsCongruence : Type := Build_IsCongruence |
| 58 | + { is_mere_relation_cong : forall (s : Sort σ), is_mere_relation (A s) (Φ s) |
| 59 | + ; equiv_rel_cong : forall (s : Sort σ), EquivRel (Φ s) |
| 60 | + ; ops_compatible_cong : OpsCompatible }. |
| 61 | + |
| 62 | + Global Arguments Build_IsCongruence {is_mere_relation_cong} |
| 63 | + {equiv_rel_cong} |
| 64 | + {ops_compatible_cong}. |
| 65 | + |
| 66 | + Global Existing Instance is_mere_relation_cong. |
| 67 | + |
| 68 | + Global Existing Instance equiv_rel_cong. |
| 69 | + |
| 70 | + Global Existing Instance ops_compatible_cong. |
| 71 | + |
| 72 | + Global Instance hprop_is_congruence `{Funext} : IsHProp IsCongruence. |
| 73 | + Proof. |
| 74 | + apply (equiv_hprop_allpath _)^-1. |
| 75 | + intros [C1 C2 C3] [D1 D2 D3]. |
| 76 | + by destruct (path_ishprop C1 D1), |
| 77 | + (path_ishprop C2 D2), |
| 78 | + (path_ishprop C3 D3). |
| 79 | + Defined. |
| 80 | + |
| 81 | +End congruence. |
| 82 | + |
| 83 | +(** A homomorphism [f : forall s, A s -> B s] is compatible |
| 84 | + with a congruence [Φ] iff [Φ s x y] implies [f s x = f s y]. *) |
| 85 | + |
| 86 | +Definition HomCompatible {σ : Signature} {A B : Algebra σ} |
| 87 | + (Φ : forall s, Relation (A s)) `{!IsCongruence A Φ} |
| 88 | + (f : forall s, A s -> B s) `{!IsHomomorphism f} |
| 89 | + : Type |
| 90 | + := forall s (x y : A s), Φ s x y -> f s x = f s y. |
| 91 | + |
0 commit comments