This theory provides basic facts about monoids.
In this section we talk about monoids. The notion of a monoid is similar to the notion of a semigroup except that we require the existence of a neutral element. It is also similar to the notion of group except that we don't require existence of the inverse.
Monoid is a set \(G\) with an associative operation and a neutral element. The operation is a function on \(G\times G\) with values in \(G\). In the context of ZF set theory this means that it is a set of pairs \(\langle x,y \rangle\), where \(x\in G\times G\) and \(y\in G\). In other words the operation is a certain subset of \((G\times G)\times G\). We express all this by defing a predicate \( \text{IsAmonoid}(G,f) \). Here \(G\) is the ''carrier'' of the monoid and \(f\) is the binary operation on it.
definition
\( \text{IsAmonoid}(G,f) \equiv \) \( f \text{ is associative on } G \wedge \) \( (\exists e\in G.\ (\forall g\in G.\ ( (f(\langle e,g\rangle ) = g) \wedge (f(\langle g,e\rangle ) = g)))) \)
The next locale called ''monoid0'' defines a context for theorems that concern monoids. In this contex we assume that the pair \((G,f)\) is a monoid. We will use the \( \oplus \) symbol to denote the monoid operation (for no particular reason).
locale monoid0
assumes monoidAssum: \( \text{IsAmonoid}(G,f) \)
defines \( a \oplus b \equiv f\langle a,b\rangle \)
Propositions proven in the semigr0 locale are valid in the monoid0 locale.
lemma (in monoid0) semigr0_valid_in_monoid0:
shows \( semigr0(G,f) \) using monoidAssum, IsAmonoid_def, semigr0_defThe result of the monoid operation is in the monoid (carrier).
lemma (in monoid0) group0_1_L1:
assumes \( a\in G \), \( b\in G \)
shows \( a\oplus b \in G \) using assms, monoidAssum, IsAmonoid_def, IsAssociative_def, apply_funtypeThere is only one neutral element in a monoid.
lemma (in monoid0) group0_1_L2:
shows \( \exists !e.\ e\in G \wedge (\forall g\in G.\ ( (e\oplus g = g) \wedge g\oplus e = g)) \)proofThe neutral element is neutral.
lemma (in monoid0) unit_is_neutral:
assumes A1: \( e = \text{ TheNeutralElement}(G,f) \)
shows \( e \in G \wedge (\forall g\in G.\ e \oplus g = g \wedge g \oplus e = g) \)proofThe monoid carrier is not empty.
lemma (in monoid0) group0_1_L3A:
shows \( G\neq 0 \)proofThe monoid operation is a binary function on the carrier with values in the carrier.
lemma (in monoid0) monoid_oper_fun:
shows \( f:G\times G\rightarrow G \) using monoidAssum unfolding IsAmonoid_def, IsAssociative_defThe range of the monoid operation is the whole monoid carrier.
lemma (in monoid0) group0_1_L3B:
shows \( \text{range}(f) = G \)proofAnother way to state that the range of the monoid operation is the whole monoid carrier.
lemma (in monoid0) range_carr:
shows \( f(G\times G) = G \) using monoidAssum, IsAmonoid_def, IsAssociative_def, group0_1_L3B, range_image_domainIn a monoid any neutral element is the neutral element.
lemma (in monoid0) group0_1_L4:
assumes A1: \( e \in G \wedge (\forall g\in G.\ e \oplus g = g \wedge g \oplus e = g) \)
shows \( e = \text{ TheNeutralElement}(G,f) \)proofThe next lemma shows that if the if we restrict the monoid operation to a subset of \(G\) that contains the neutral element, then the neutral element of the monoid operation is also neutral with the restricted operation.
lemma (in monoid0) group0_1_L5:
assumes A1: \( \forall x\in H.\ \forall y\in H.\ x\oplus y \in H \) and A2: \( H\subseteq G \) and A3: \( e = \text{ TheNeutralElement}(G,f) \) and A4: \( g = \text{restrict}(f,H\times H) \) and A5: \( e\in H \) and A6: \( h\in H \)
shows \( g\langle e,h\rangle = h \wedge g\langle h,e\rangle = h \)proofThe next theorem shows that if the monoid operation is closed on a subset of \(G\) then this set is a (sub)monoid (although we do not define this notion). This fact will be useful when we study subgroups.
theorem (in monoid0) group0_1_T1:
assumes A1: \( H \text{ is closed under } f \) and A2: \( H\subseteq G \) and A3: \( \text{ TheNeutralElement}(G,f) \in H \)
shows \( \text{IsAmonoid}(H,\text{restrict}(f,H\times H)) \)proofUnder the assumptions of group0_1_T1 the neutral element of a submonoid is the same as that of the monoid.
lemma group0_1_L6:
assumes A1: \( \text{IsAmonoid}(G,f) \) and A2: \( H \text{ is closed under } f \) and A3: \( H\subseteq G \) and A4: \( \text{ TheNeutralElement}(G,f) \in H \)
shows \( \text{ TheNeutralElement}(H,\text{restrict}(f,H\times H)) = \text{ TheNeutralElement}(G,f) \)proofIf a sum of two elements is not zero, then at least one has to be nonzero.
lemma (in monoid0) sum_nonzero_elmnt_nonzero:
assumes \( a \oplus b \neq \text{ TheNeutralElement}(G,f) \)
shows \( a \neq \text{ TheNeutralElement}(G,f) \vee b \neq \text{ TheNeutralElement}(G,f) \) using assms, unit_is_neutralThe monoid operation is associative.
lemma (in monoid0) sum_associative:
assumes \( a\in G \), \( b\in G \), \( c\in G \)
shows \( (a\oplus b)\oplus c = a\oplus (b\oplus c) \) using assms, monoidAssum unfolding IsAmonoid_def, IsAssociative_defA simple rearrangement of four monoid elements transferred from the semigr0 locale:
lemma (in monoid0) rearr4elem_monoid:
assumes \( a\in G \), \( b\in G \), \( c\in G \), \( d\in G \)
shows \( a\oplus b\oplus (c\oplus d) = a\oplus (b\oplus c)\oplus d \) using assms, semigr0_valid_in_monoid0, rearr4elem_assocassumes \( e = \text{ TheNeutralElement}(G,f) \)
shows \( e \in G \wedge (\forall g\in G.\ e \oplus g = g \wedge g \oplus e = g) \)assumes \( f:X\rightarrow Y \)
shows \( \text{range}(f) \subseteq Y \)assumes \( f:X\rightarrow Y \), \( x\in X \), \( y = f(x) \)
shows \( \langle x,y\rangle \in f \), \( y \in \text{range}(f) \)assumes \( f:X\rightarrow Y \)
shows \( f(X) = \text{range}(f) \)assumes \( f:X\rightarrow Y \) and \( A\subseteq X \) and \( \forall x\in A.\ f(x) \in Z \)
shows \( \text{restrict}(f,A) : A\rightarrow Z \)assumes \( \forall x\in H.\ \forall y\in H.\ x\oplus y \in H \) and \( H\subseteq G \) and \( e = \text{ TheNeutralElement}(G,f) \) and \( g = \text{restrict}(f,H\times H) \) and \( e\in H \) and \( h\in H \)
shows \( g\langle e,h\rangle = h \wedge g\langle h,e\rangle = h \)assumes \( H \text{ is closed under } f \) and \( H\subseteq G \) and \( \text{ TheNeutralElement}(G,f) \in H \)
shows \( \text{IsAmonoid}(H,\text{restrict}(f,H\times H)) \)assumes \( e \in G \wedge (\forall g\in G.\ e \oplus g = g \wedge g \oplus e = g) \)
shows \( e = \text{ TheNeutralElement}(G,f) \)assumes \( a\in G \), \( b\in G \), \( c\in G \), \( d\in G \)
shows \( a\cdot b\cdot (c\cdot d) = a\cdot (b\cdot c)\cdot d \)