In this theory file we extend the work on equivalence relations done in the standard Isabelle's EquivClass theory. That development is very good and all, but we really would prefer an approach contained within the a standard ZF set theory, without extensions specific to Isabelle. That is why this theory is written.
Suppose we have a set \(X\) with a relation \(r\subseteq X\times X\) and a function \(f: X\rightarrow X\). The function \(f\) can be compatible (congruent) with \(r\) in the sense that if two elements \(x,y\) are related then the values \(f(x), f(x)\) are also related. This is especially useful if \(r\) is an equivalence relation as it allows to "project" the function to the quotient space \(X/r\) (the set of equivalence classes of \(r\)) and create a new function \(F\) that satifies the formula \(F([x]_r) = [f(x)]_r\). When \(f\) is congruent with respect to \(r\) such definition of the value of \(F\) on the equivalence class \([x]_r\) does not depend on which \(x\) we choose to represent the class. In this section we also consider binary operations that are congruent with respect to a relation. These are important in algebra - the congruency condition allows to project the operation to obtain the operation on the quotient space.
First we define the notion of function that maps equivalent elements to equivalent values. We use similar names as in the Isabelle's standard EquivClass theory to indicate the conceptual correspondence of the notions.
definition
\( \text{Congruent}(r,f) \equiv \) \( (\forall x y.\ \langle x,y\rangle \in r \longrightarrow \langle f(x),f(y)\rangle \in r) \)
Now we will define the projection of a function onto the quotient space. In standard math the equivalence class of \(x\) with respect to relation \(r\) is usually denoted \([x]_r\). Here we reuse notation \(r\{ x\}\) instead. This means the image of the set \(\{ x\}\) with respect to the relation, which, for equivalence relations is exactly its equivalence class if you think about it.
definition
\( \text{ProjFun}(A,r,f) \equiv \) \( \{\langle c,\bigcup x\in c.\ r\{f(x)\}\rangle .\ c \in (A//r)\} \)
Elements of equivalence classes belong to the set.
lemma EquivClass_1_L1:
assumes A1: \( \text{equiv}(A,r) \) and A2: \( C \in A//r \) and A3: \( x\in C \)
shows \( x\in A \)proofThe image of a subset of \(X\) under projection is a subset of \(A/r\).
lemma EquivClass_1_L1A:
assumes \( A\subseteq X \)
shows \( \{r\{x\}.\ x\in A\} \subseteq X//r \) using assms, quotientIIf an element belongs to an equivalence class, then its image under relation is this equivalence class.
lemma EquivClass_1_L2:
assumes A1: \( \text{equiv}(A,r) \), \( C \in A//r \) and A2: \( x\in C \)
shows \( r\{x\} = C \)proofElements that belong to the same equivalence class are equivalent.
lemma EquivClass_1_L2A:
assumes \( \text{equiv}(A,r) \), \( C \in A//r \), \( x\in C \), \( y\in C \)
shows \( \langle x,y\rangle \in r \) using assms, EquivClass_1_L2, EquivClass_1_L1, equiv_class_eq_iffElements that have the same image under an equivalence relation are equivalent. This is the same as eq_equiv_class from standard Isabelle/ZF's EquivClass theory, just copied here to be easier to find.
lemma same_image_equiv:
assumes \( \text{equiv}(A,r) \), \( y\in A \), \( r\{x\} = r\{y\} \)
shows \( \langle x,y\rangle \in r \) using assms, eq_equiv_classEvery \(x\) is in the class of \(y\), then they are equivalent.
lemma EquivClass_1_L2B:
assumes A1: \( \text{equiv}(A,r) \) and A2: \( y\in A \) and A3: \( x \in r\{y\} \)
shows \( \langle x,y\rangle \in r \)proofIf a function is congruent then the equivalence classes of the values that come from the arguments from the same class are the same.
lemma EquivClass_1_L3:
assumes A1: \( \text{equiv}(A,r) \) and A2: \( \text{Congruent}(r,f) \) and A3: \( C \in A//r \), \( x\in C \), \( y\in C \)
shows \( r\{f(x)\} = r\{f(y)\} \)proofThe values of congruent functions are in the space.
lemma EquivClass_1_L4:
assumes A1: \( \text{equiv}(A,r) \) and A2: \( C \in A//r \), \( x\in C \) and A3: \( \text{Congruent}(r,f) \)
shows \( f(x) \in A \)proofEquivalence classes are not empty.
lemma EquivClass_1_L5:
assumes A1: \( \text{refl}(A,r) \) and A2: \( C \in A//r \)
shows \( C\neq 0 \)proofTo avoid using an axiom of choice, we define the projection using the expression \(\bigcup _{x\in C} r(\{f(x)\})\). The next lemma shows that for congruent function this is in the quotient space \(A/r\).
lemma EquivClass_1_L6:
assumes A1: \( \text{equiv}(A,r) \) and A2: \( \text{Congruent}(r,f) \) and A3: \( C \in A//r \)
shows \( (\bigcup x\in C.\ r\{f(x)\}) \in A//r \)proofCongruent functions can be projected.
lemma EquivClass_1_T0:
assumes \( \text{equiv}(A,r) \), \( \text{Congruent}(r,f) \)
shows \( \text{ProjFun}(A,r,f) : A//r \rightarrow A//r \) using assms, EquivClass_1_L6, ProjFun_def, ZF_fun_from_totalWe now define congruent functions of two variables (binary funtions). The predicate Congruent2 corresponds to congruent2 in Isabelle's standard EquivClass theory, but uses ZF-functions rather than meta-functions.
definition
\( \text{Congruent2}(r,f) \equiv \) \( (\forall x_1 x_2 y_1 y_2.\ \langle x_1,x_2\rangle \in r \wedge \langle y_1,y_2\rangle \in r \longrightarrow \) \( \langle f\langle x_1,y_1\rangle , f\langle x_2,y_2\rangle \rangle \in r) \)
Next we define the notion of projecting a binary operation to the quotient space. This is a very important concept that allows to define quotient groups, among other things.
definition
\( \text{ProjFun2}(A,r,f) \equiv \) \( \{\langle p,\bigcup z \in \text{fst}(p)\times \text{snd}(p).\ r\{f(z)\}\rangle .\ p \in (A//r)\times (A//r) \} \)
The following lemma is a two-variables equivalent of EquivClass_1_L3.
lemma EquivClass_1_L7:
assumes A1: \( \text{equiv}(A,r) \) and A2: \( \text{Congruent2}(r,f) \) and A3: \( C_1 \in A//r \), \( C_2 \in A//r \) and A4: \( z_1 \in C_1\times C_2 \), \( z_2 \in C_1\times C_2 \)
shows \( r\{f(z_1)\} = r\{f(z_2)\} \)proofThe values of congruent functions of two variables are in the space.
lemma EquivClass_1_L8:
assumes A1: \( \text{equiv}(A,r) \) and A2: \( C_1 \in A//r \) and A3: \( C_2 \in A//r \) and A4: \( z \in C_1\times C_2 \) and A5: \( \text{Congruent2}(r,f) \)
shows \( f(z) \in A \)proofThe values of congruent functions are in the space. Note that although this lemma is intended to be used with functions, we don't need to assume that \(f\) is a function.
lemma EquivClass_1_L8A:
assumes A1: \( \text{equiv}(A,r) \) and A2: \( x\in A \), \( y\in A \) and A3: \( \text{Congruent2}(r,f) \)
shows \( f\langle x,y\rangle \in A \)proofThe following lemma is a two-variables equivalent of EquivClass_1_L6.
lemma EquivClass_1_L9:
assumes A1: \( \text{equiv}(A,r) \) and A2: \( \text{Congruent2}(r,f) \) and A3: \( p \in (A//r)\times (A//r) \)
shows \( (\bigcup z \in \text{fst}(p)\times \text{snd}(p).\ r\{f(z)\}) \in A//r \)proofCongruent functions of two variables can be projected.
theorem EquivClass_1_T1:
assumes \( \text{equiv}(A,r) \), \( \text{Congruent2}(r,f) \)
shows \( \text{ProjFun2}(A,r,f) : (A//r)\times (A//r) \rightarrow A//r \) using assms, EquivClass_1_L9, ProjFun2_def, ZF_fun_from_totalThe projection diagram commutes. I wish I knew how to draw this diagram in LaTeX.
lemma EquivClass_1_L10:
assumes A1: \( \text{equiv}(A,r) \) and A2: \( \text{Congruent2}(r,f) \) and A3: \( x\in A \), \( y\in A \)
shows \( \text{ProjFun2}(A,r,f)\langle r\{x\},r\{y\}\rangle = r\{f\langle x,y\rangle \} \)proofIn this section we show that if the operations are congruent with respect to an equivalence relation then the projection to the quotient space preserves commutativity, associativity and distributivity.
The projection of commutative operation is commutative.
lemma EquivClass_2_L1:
assumes A1: \( \text{equiv}(A,r) \) and A2: \( \text{Congruent2}(r,f) \) and A3: \( f \text{ is commutative on } A \) and A4: \( c1 \in A//r \), \( c2 \in A//r \)
shows \( \text{ProjFun2}(A,r,f)\langle c1,c2\rangle = \text{ProjFun2}(A,r,f)\langle c2,c1\rangle \)proofThe projection of commutative operation is commutative.
theorem EquivClass_2_T1:
assumes \( \text{equiv}(A,r) \) and \( \text{Congruent2}(r,f) \) and \( f \text{ is commutative on } A \)
shows \( \text{ProjFun2}(A,r,f) \text{ is commutative on } A//r \) using assms, IsCommutative_def, EquivClass_2_L1The projection of an associative operation is associative.
lemma EquivClass_2_L2:
assumes A1: \( \text{equiv}(A,r) \) and A2: \( \text{Congruent2}(r,f) \) and A3: \( f \text{ is associative on } A \) and A4: \( c1 \in A//r \), \( c2 \in A//r \), \( c3 \in A//r \) and A5: \( g = \text{ProjFun2}(A,r,f) \)
shows \( g\langle g\langle c1,c2\rangle ,c3\rangle = g\langle c1,g\langle c2,c3\rangle \rangle \)proofThe projection of an associative operation is associative on the quotient.
theorem EquivClass_2_T2:
assumes A1: \( \text{equiv}(A,r) \) and A2: \( \text{Congruent2}(r,f) \) and A3: \( f \text{ is associative on } A \)
shows \( \text{ProjFun2}(A,r,f) \text{ is associative on } A//r \)proofThe essential condition to show that distributivity is preserved by projections to quotient spaces, provided both operations are congruent with respect to the equivalence relation.
lemma EquivClass_2_L3:
assumes A1: \( \text{IsDistributive}(X,A,M) \) and A2: \( \text{equiv}(X,r) \) and A3: \( \text{Congruent2}(r,A) \), \( \text{Congruent2}(r,M) \) and A4: \( a \in X//r \), \( b \in X//r \), \( c \in X//r \) and A5: \( A_p = \text{ProjFun2}(X,r,A) \), \( M_p = \text{ProjFun2}(X,r,M) \)
shows \( M_p\langle a,A_p\langle b,c\rangle \rangle = A_p\langle M_p\langle a,b\rangle ,M_p\langle a,c\rangle \rangle \wedge \) \( M_p\langle A_p\langle b,c\rangle ,a \rangle = A_p\langle M_p\langle b,a\rangle , M_p\langle c,a\rangle \rangle \)proofDistributivity is preserved by projections to quotient spaces, provided both operations are congruent with respect to the equivalence relation.
lemma EquivClass_2_L4:
assumes A1: \( \text{IsDistributive}(X,A,M) \) and A2: \( \text{equiv}(X,r) \) and A3: \( \text{Congruent2}(r,A) \), \( \text{Congruent2}(r,M) \)
shows \( \text{IsDistributive}(X//r, \text{ProjFun2}(X,r,A), \text{ProjFun2}(X,r,M)) \)proofIn this section we consider sets that are saturated with respect to an equivalence relation. A set \(A\) is saturated with respect to a relation \(r\) if \(A=r^{-1}(r(A))\). For equivalence relations saturated sets are unions of equivalence classes. This makes them useful as a tool to define subsets of the quotient space using properties of representants. Namely, we often define a set \(B\subseteq X/r\) by saying that \([x]_r \in B\) iff \(x\in A\). If \(A\) is a saturated set, this definition is consistent in the sense that it does not depend on the choice of \(x\) to represent \([x]_r\).
The following defines the notion of a saturated set. Recall that in Isabelle \( r^{-1}(A) \) is the inverse image of \(A\) with respect to relation \(r\). This definition is not specific to equivalence relations.
definition
\( \text{IsSaturated}(r,A) \equiv A = r^{-1}(r(A)) \)
For equivalence relations a set is saturated iff it is an image of itself.
lemma EquivClass_3_L1:
assumes A1: \( \text{equiv}(X,r) \)
shows \( \text{IsSaturated}(r,A) \longleftrightarrow A = r(A) \)proofFor equivalence relations sets are contained in their images.
lemma EquivClass_3_L2:
assumes A1: \( \text{equiv}(X,r) \) and A2: \( A\subseteq X \)
shows \( A \subseteq r(A) \)proofThe next lemma shows that if "\(\sim\)" is an equivalence relation and a set \(A\) is such that \(a\in A\) and \(a\sim b\) implies \(b\in A\), then \(A\) is saturated with respect to the relation.
lemma EquivClass_3_L3:
assumes A1: \( \text{equiv}(X,r) \) and A2: \( r \subseteq X\times X \) and A3: \( A\subseteq X \) and A4: \( \forall x\in A.\ \forall y\in X.\ \langle x,y\rangle \in r \longrightarrow y\in A \)
shows \( \text{IsSaturated}(r,A) \)proofIf \(A\subseteq X\) and \(A\) is saturated and \(x\sim y\), then \(x\in A\) iff \(y\in A\). Here we show only one direction.
lemma EquivClass_3_L4:
assumes A1: \( \text{equiv}(X,r) \) and A2: \( \text{IsSaturated}(r,A) \) and A3: \( A\subseteq X \) and A4: \( \langle x,y\rangle \in r \) and A5: \( x\in X \), \( y\in A \)
shows \( x\in A \)proofIf \(A\subseteq X\) and \(A\) is saturated and \(x\sim y\), then \(x\in A\) iff \(y\in A\).
lemma EquivClass_3_L5:
assumes A1: \( \text{equiv}(X,r) \) and A2: \( \text{IsSaturated}(r,A) \) and A3: \( A\subseteq X \) and A4: \( x\in X \), \( y\in X \) and A5: \( \langle x,y\rangle \in r \)
shows \( x\in A \longleftrightarrow y\in A \)proofIf \(A\) is saturated then \(x\in A\) iff its class is in the projection of \(A\).
lemma EquivClass_3_L6:
assumes A1: \( \text{equiv}(X,r) \) and A2: \( \text{IsSaturated}(r,A) \) and A3: \( A\subseteq X \) and A4: \( x\in X \) and A5: \( B = \{r\{x\}.\ x\in A\} \)
shows \( x\in A \longleftrightarrow r\{x\} \in B \)proofA technical lemma involving a projection of a saturated set and a logical epression with exclusive or. Note that we don't really care what Xor is here, this is true for any predicate.
lemma EquivClass_3_L7:
assumes \( \text{equiv}(X,r) \) and \( \text{IsSaturated}(r,A) \) and \( A\subseteq X \) and \( x\in X \), \( y\in X \) and \( B = \{r\{x\}.\ x\in A\} \) and \( (x\in A) \text{ Xor } (y\in A) \)
shows \( (r\{x\} \in B) \text{ Xor } (r\{y\} \in B) \) using assms, EquivClass_3_L6assumes \( \text{equiv}(A,r) \) and \( C \in A//r \) and \( x\in C \)
shows \( x\in A \)assumes \( \text{equiv}(A,r) \), \( C \in A//r \) and \( x\in C \)
shows \( r\{x\} = C \)assumes \( \text{equiv}(A,r) \), \( C \in A//r \), \( x\in C \), \( y\in C \)
shows \( \langle x,y\rangle \in r \)assumes \( \text{refl}(A,r) \) and \( C \in A//r \)
shows \( C\neq 0 \)assumes \( \text{equiv}(A,r) \) and \( C \in A//r \), \( x\in C \) and \( \text{Congruent}(r,f) \)
shows \( f(x) \in A \)assumes \( \text{equiv}(A,r) \) and \( \text{Congruent}(r,f) \) and \( C \in A//r \), \( x\in C \), \( y\in C \)
shows \( r\{f(x)\} = r\{f(y)\} \)assumes \( C\neq \emptyset \) and \( \forall x\in C.\ b(x) \in A \) and \( \forall x y.\ x\in C \wedge y\in C \longrightarrow b(x) = b(y) \)
shows \( (\bigcup x\in C.\ b(x))\in A \)assumes \( \text{equiv}(A,r) \) and \( \text{Congruent}(r,f) \) and \( C \in A//r \)
shows \( (\bigcup x\in C.\ r\{f(x)\}) \in A//r \)assumes \( \forall x\in X.\ b(x) \in Y \)
shows \( \{\langle x,b(x)\rangle .\ x\in X\} : X\rightarrow Y \)assumes \( \text{equiv}(A,r) \) and \( C_1 \in A//r \) and \( C_2 \in A//r \) and \( z \in C_1\times C_2 \) and \( \text{Congruent2}(r,f) \)
shows \( f(z) \in A \)assumes \( \text{equiv}(A,r) \) and \( \text{Congruent2}(r,f) \) and \( C_1 \in A//r \), \( C_2 \in A//r \) and \( z_1 \in C_1\times C_2 \), \( z_2 \in C_1\times C_2 \)
shows \( r\{f(z_1)\} = r\{f(z_2)\} \)assumes \( \text{equiv}(A,r) \) and \( \text{Congruent2}(r,f) \) and \( p \in (A//r)\times (A//r) \)
shows \( (\bigcup z \in \text{fst}(p)\times \text{snd}(p).\ r\{f(z)\}) \in A//r \)assumes \( C\neq \emptyset \) and \( \forall y\in C.\ b(y) = A \)
shows \( (\bigcup y\in C.\ b(y)) = A \)assumes \( \text{equiv}(A,r) \), \( \text{Congruent2}(r,f) \)
shows \( \text{ProjFun2}(A,r,f) : (A//r)\times (A//r) \rightarrow A//r \)assumes \( f:X\rightarrow Y \), \( x\in X \) and \( f = \{\langle x,b(x)\rangle .\ x\in X\} \)
shows \( f(x) = b(x) \) and \( b(x)\in Y \)assumes \( \text{equiv}(A,r) \) and \( \text{Congruent2}(r,f) \) and \( x\in A \), \( y\in A \)
shows \( \text{ProjFun2}(A,r,f)\langle r\{x\},r\{y\}\rangle = r\{f\langle x,y\rangle \} \)assumes \( \text{equiv}(A,r) \) and \( \text{Congruent2}(r,f) \) and \( f \text{ is commutative on } A \) and \( c1 \in A//r \), \( c2 \in A//r \)
shows \( \text{ProjFun2}(A,r,f)\langle c1,c2\rangle = \text{ProjFun2}(A,r,f)\langle c2,c1\rangle \)assumes \( \text{equiv}(A,r) \) and \( \text{Congruent2}(r,f) \) and \( f \text{ is associative on } A \) and \( c1 \in A//r \), \( c2 \in A//r \), \( c3 \in A//r \) and \( g = \text{ProjFun2}(A,r,f) \)
shows \( g\langle g\langle c1,c2\rangle ,c3\rangle = g\langle c1,g\langle c2,c3\rangle \rangle \)assumes \( \text{equiv}(A,r) \) and \( x\in A \), \( y\in A \) and \( \text{Congruent2}(r,f) \)
shows \( f\langle x,y\rangle \in A \)assumes \( \text{IsDistributive}(X,A,M) \) and \( \text{equiv}(X,r) \) and \( \text{Congruent2}(r,A) \), \( \text{Congruent2}(r,M) \) and \( a \in X//r \), \( b \in X//r \), \( c \in X//r \) and \( A_p = \text{ProjFun2}(X,r,A) \), \( M_p = \text{ProjFun2}(X,r,M) \)
shows \( M_p\langle a,A_p\langle b,c\rangle \rangle = A_p\langle M_p\langle a,b\rangle ,M_p\langle a,c\rangle \rangle \wedge \) \( M_p\langle A_p\langle b,c\rangle ,a \rangle = A_p\langle M_p\langle b,a\rangle , M_p\langle c,a\rangle \rangle \)assumes \( \text{equiv}(X,r) \) and \( A\subseteq X \)
shows \( A \subseteq r(A) \)assumes \( \text{equiv}(X,r) \)
shows \( \text{IsSaturated}(r,A) \longleftrightarrow A = r(A) \)assumes \( \text{equiv}(X,r) \) and \( \text{IsSaturated}(r,A) \) and \( A\subseteq X \) and \( \langle x,y\rangle \in r \) and \( x\in X \), \( y\in A \)
shows \( x\in A \)assumes \( \text{equiv}(X,r) \) and \( \langle x,y\rangle \in r \)
shows \( \langle y,x\rangle \in r \)assumes \( \text{equiv}(X,r) \) and \( \text{IsSaturated}(r,A) \) and \( A\subseteq X \) and \( x\in X \) and \( B = \{r\{x\}.\ x\in A\} \)
shows \( x\in A \longleftrightarrow r\{x\} \in B \)