1 Introduction

The study of semiheaps can be traced back to the early work on semigroup theory by Baer [2], Prüfer [16] and Suškevič [17]. They investigated what were later known as heaps, certain kinds of ternary algebras arising from groups and semigroups satisfying some special conditions; see Definitions 2.1 and 2.10. Heaps and groups are closely related. From a heap \((H,[-,-,-])\) one can construct a group \(\textrm{G}(H)\). This is achieved by fixing an element \(a\in H\) and currying it in the middle argument of the ternary operation \([-,-,-]\) to acquire a binary one . Conversely, we can associate a heap \(\textrm{H}(G)\) with a group \((G,\cdot )\) by taking the ternary bracket \([a,b,c]:=a\cdot b^{-1}\cdot c\), where \(a,b,c\in G\). If we start with a ternary operation, these constructions compose to the original structure. In the other direction, starting with a group, we only obtain the group up to isomorphism as we forget which element is fixed, but we always find a so-called variant, see [10]. Wagner [19] introduced semiheaps in the context of partial functions and relations on sets as a way to formalize the theory of coordinate charts on manifolds. A semiheap is a straightforward generalisation of a heap: a ternary algebra with the generalized associativity property satisfied by heaps but without any cancelling behaviour of elements, that is, \((S,[-,-,-])\) such that

$$\begin{aligned}{}[[a,b,c],d,e]=[a,[d,c,b],e]=[a,b,[c,d,e]] \end{aligned}$$

for all \(a,b,c,d,e\in S\). These ternary algebras have applications to Morita equivalence [15], pseudogroups [13], affine structures [4, 9], Lie theory and quantum mechanics [5, 6], and hypermatrix theory [1, 21]. In contrast to groups and heaps, no correspondences between general semiheaps and semigroups have been found to date. We can associate with every semiheap a semigroup by fixing an element. For different choices, however, semigroups do not have to be isomorphic anymore. The opposite direction is not unique either, more data is required. In his seminal paper [19], Wagner shows that there is a correspondence between involuted monoids and semiheaps with biunit elements, that is elements \(e\in S\) satisfying

$$\begin{aligned}{}[e,e,x]=x=[x,e,e] \end{aligned}$$

for all \(a\in S\). If there exists a biunit element, one can build an involuted monoid from a semiheap, and then reconstruct it from the monoid. Similarly, for monoids with involutive anti-homomorphism, we construct a semiheap with biunit from an involuted monoid, and then reconstruct the monoid up to isomorphism. Our contribution is to consider a more parsimonious generalization of biunit elements in semiheaps by considering a pair (ab) such that:

$$\begin{aligned}{}[a,b,x]=x=[x,a,b] \end{aligned}$$

which we call a biunit pair. The main purpose of our paper is to extend the classical result of Wagner [19] to semiheaps with biunit pairs and determine the appropriate class of semigroups that establishes the correspondence.

We begin in Sect. 2 by recalling some generalities about ternary operations and semiheaps. We establish our notation and conventions by introducing ternars, currying and semiheaps.

In Sect. 3, we introduce twistings of semiheaps, i.e. a pair \(S_\varphi :=(S,[-,\varphi (-),-])\) is a \(\varphi \)-twist of \((S,[-,-,-])\) if \(S_\varphi \) is a semiheap, and function \(\varphi :S \rightarrow S\) is called a twist. In Definition 3.3, we introduce a special case of a twist called a warp. We show that in the case of abelian semiheap or existence of particular injective currying, twists coincide with warps, see Lemma 3.7. We observe that the relation of differing by a bijective warp gives an equivalence relation on the set of all twistings of a semiheap. Similarly, we introduce an function \(\psi :S\rightarrow S\) called a switch. A switch allows us to associate with a semigroup \((S,\cdot )\), a semiheap \((S,[-,-,-]^{\psi })\), where \([a,b,c]^\psi :=a\cdot \psi (b)\cdot c\) for all \(a,b,c\in S\). If a semigroup S has at least one left and one right cancellative element, switches correspond to all semiheap structures given by the bracket \([-,-,-]^\psi \), see Lemma 3.19. In the case of abelian semiheaps, switches coincide with warps of \((S,[-,-,-]^\textrm{Id})\) see Lemma 3.23. Proposition 3.25 gives us the properties of switches for monoids. The proposition is crucial to prove the main theorem of the paper. The most important property is that if \(\varphi \) is a switch for some monoid S and there exist \(u\in S\) such that \(\varphi (u)=1\), then u is invertible and \(u^{-1}=\varphi (1)\).

Section 4 introduces biunit pairs a pairs in a semiheap S in Definition 4.1. A biunit pair is a generalisation of biunits, as any biunit element \(a\in S\) (see Definition 2.5) belongs to a biunit pair (aa) in S. For curryings, lower arity functions created by fixing elements in a semiheap ternary operation, given by biunit pairs, left and right shifts give us bijective warps. That said, semiheaps S, \(S_{\lambda _{aa}}\), \(S_{\lambda _{bb}}\), \(S_{\rho _{aa}}\), and \(S_{\rho _{bb}}\) are warp equivalent see Corollary 4.9. We observe that if \((S,[-,-,-])\) is a heap with a biunit pair (ab), then the currying is a switch for a monoid , where for all \(x,y\in S\), b is an identity, and \(\mu _{bb}(a)=b\), see Lemma 4.13 and corollary 4.14. These two observations with Proposition 3.25 allows us to formulate and prove our main result in Theorem 4.16. The theorem states that there is a one-to-one correspondence between monoids with an invertible switch and semiheaps with a choice of biunit pair. We conclude our contribution by motivating the definition of diheaps as semiheaps whose elements belong to biunit pairs and showing that these previously unknown structures are related but are not isomorphic to heaps. Proposition 4.20 shows that diheaps and heaps are warp-equivalent.

2 Preliminaries

Throughout this work we will consider a set T together with a ternary operation, that is a map \([-,-,-]_T:T\times T\times T\rightarrow T\). We will call a pair \((T,[-,-,-]_T)\) a ternar. Following the universal algebra approach a morphism of ternars \((T,[-,-,-]_T)\) and \((H,[-,-,-]_H)\) is a function \(\varphi :T\rightarrow H\) such that \(\varphi ([a,b,c]_T)=[\varphi (a),\varphi (b),\varphi (c)]_H\), for all \(a,b,c\in T\), see [3]. We shall omit index of the ternary operation and write \((T,[-,-,-]):=(T,[-,-,-]_T)\), keeping in mind on which set the bracket \([-,-,-]\) is defined.

Given a ternar \((T,[-,-,-])\), lower arity binary operations arise in a natural way by currying elements into the ternary operation in different ways. By currying a single element a we get the following three binary operations:

(2.1)

for \(x,y\in T\). For our purposes the most important will be the middle one: the pair will be called a-retract of the ternar T. Similarly, by currying a pair of elements \((a,b) \in T\times T\) we obtain the following three unary operations:

$$\begin{aligned} \lambda _{ab}(x):=[a,b,x] \qquad \mu _{ab}(x):= [a,x,b] \qquad \rho _{ab}:=[x,a,b] \end{aligned}$$
(2.2)

for \(x\in T\). These are endofunctions of the underlying set T, so we call them, respectively, the left, middle and right shifts of the ternar \((T,[-,-,-])\).

In this paper we will mainly consider a particular class of ternars called semiheaps.

Definition 2.1

A semiheap is a set S together with a ternary operation \([-,-,-]:S\times S\times S\rightarrow S\) such that for all \(a,b,c,d,e\in S\),

$$\begin{aligned}{}[[a,b,c],d,e]=[a,[d,c,b],e]=[a,b,[c,d,e]]. \end{aligned}$$
(2.3)

Note that the middle term in (2.3) implies a departure from (ordinary) sequential associativity i.e. the property that notationally allows for brackets to be dropped. Consequently, property (2.3) has been called weak associativity [18], associativity of the second kind [7], quasi-associativity [14], para-associativity [8], type B associativity [12] and pseudo-associativity [11].

Definition 2.2

Given a semiheap \((S,[-,-,-])\), a simple check shows that if the ternary operation \([-,-,-]\) satisfies (2.3) then so does \(\overline{[a,b,c]}:=[c,b,a]\); \((S,\overline{[-,-,-]})\) is called the reverse semiheap. A semiheap \((S,[-,-,-])\) is called abelian when \([-,-,-]=\overline{[-,-,-]}\).

Example 2.3

The classical example of a semiheap is the compositional structure of the set of binary relations between two arbitrary sets \(\textsf {Rel}(A,B)\) given by the following ternary operation:

$$\begin{aligned}{}[R_1,R_2,R_3]_\textsf {Rel}:= R_1 \circ R_2^\top \circ R_3 \end{aligned}$$

where \(R_1,R_2,R_3\subset A\times B\) are binary relations, \(\circ \) is the usual composition of relations and \(\top \) denotes the transpose or converse relation. It is easy to see that (2.3) holds as a direct consequence of the associativity property of \(\circ \) and the fact that \(\top \) is an involution and a \(\circ \)-antihomomorphism. More generally, the homsets of any dagger category \((\mathcal {C},\dag )\) carry a semiheap structure via the analogous construction:

$$\begin{aligned}{}[f,g,h]_\mathcal {C}:= f \circ g^\dag \circ h \end{aligned}$$

for \(f,g,h\in \mathcal {C}(A,B)\) and any two objects \(A,B\in \mathcal {C}\). The commutative diagram that realizes this ternary operation in a dagger category displays a characteristic zigzag pattern:

(2.4)

Example 2.4

Let G be a set together with an associative binary operation \(\cdot \) and a function \(*:G\rightarrow G\) satisfying \((a^*)^*=a\) and \((a\cdot b)^*=b^*\cdot a^*\) for all \(a,b\in G\), that is, \(*\) is an antihomomorphic involution, then it is easy to show that the ternary operation defined by

$$\begin{aligned}{}[a,b,c]_G:= a \cdot b^*\cdot c \end{aligned}$$

satisfies (2.3) thus making \((G,[-,-,-]_G)\) into a semiheap. In particular, all groups carry a canonical semiheap structure via the above construction by considering the inversion involution \(*=\,^{-1}\).

Note that all these examples correspond to ternary operations constructed from an associative binary operation that is twisted by some map, in reference to the diagram (2.4).

Definition 2.5

Let \((S,[-,-,-])\) be a semiheap, we say that element \(e\in S\) is a left (right) Mal’cev element or a left (right) biunit if for all \(s\in S\)

$$\begin{aligned}{}[e,e,s]=s \qquad ([s,e,e]=s). \end{aligned}$$

If an element \(e\in S\) is a left and right biunit, we call it a biunit or Mal’cev element.

The existence of Mal’cev elements in a semiheap allows us to construct an involuted monoid.

Theorem 2.6

[Involuted Monoid of a Semiheap with Biunit, Thm. 8.2.8-9 [11] or Thm. 2.8-9 [19]] Let \((S,[-,-,-])\) be a semiheap and \(e\in S\) be a Mal’cev element, then the binary operation

and the map

$$\begin{aligned} \mu _{ee}(a):= [e,a,e] \end{aligned}$$

make into an involuted monoid with e as identity element such that the original semiheap structure is recovered by the ternary operation:

Furthermore, if there exists another biunit \(u\in S\), then there is an isomorphism of involuted monoids given by

$$\begin{aligned} \rho _{eu}(a):= [a,e,u]. \end{aligned}$$

Corollary 2.7

There is a one-to-one correspondence between semiheaps with a chosen biunit element and involuted monoids:

$$\begin{aligned} \{ \text {semiheap} + \text {biunit} \,\, \text {element} \} \rightleftharpoons \{ \text {involuted} \,\, \text {monoid} \} \end{aligned}$$

which is realized explicitly via the assignments:

The connection between semiheaps and involuted monoids is, in fact, more general.

Theorem 2.8

[Semiheaps Embed into Involution Monoids, Thm. 8.2.10-11 [11] or Thm. 2.10-11 [19]] Any semiheap can be homomorphically embedded into a semiheap with a Mal’cev element. Therefore, it follows from Theorem 2.6 that any semiheap can be embedded into an involuted monoid.

Remark 2.9

In the case of a semiheap \((S,[-,-,-])\) with a biunit \(e\in S\), we get that a-retract of S is a variant (S, [eae]) of e-retract of S, see [10].

Definition 2.10

A heap is a semiheap \((H,[-,-,-])\) in which every element is Mal’cev.

Example 2.11

If \((G,\cdot )\) is a group, then a pair \((G,[-,-,-])\), where \([a,b,c]=a\cdot b^{-1}\cdot c\) for all \(a,b,c\in G\), is a heap.

Note that Theorems 2.6 and 2.8 restrict to equivalent statements for heaps and groups.

3 Twists, warps and switches

In this section, we study the twistings of semiheaps. By that, we understand a method to deform a ternary operation to acquire a new semiheap. Furthermore, we research connections among semigroups, semiheaps and twisted semiheaps. Let us start by identifying the notion of twist.

Definition 3.1

Let \((T,[-,-,-])\) be a ternary algebra and \(\varphi :T\rightarrow T\) a function. Then \(T_{\phi }\) is the ternary algebra \((T,[-,-,-]_\varphi )\) where \([a,b,c]_\varphi :=[a,\varphi (b),c]\) for all \(a,b,c\in S\). We say that \(T_{\phi }\) is the \(\varphi \)-twist of T and \(\varphi \) is a twist.

Definition 3.2

Let \((S,[-,-,-])\) be a semiheap and \(\varphi :S\rightarrow S\) a twist. We say that that \(\varphi \) is a semiheap twist if \(S_\varphi \) is a semiheap.

We will be particularly interested in semiheaps twisted by warps.

Definition 3.3

Let \((S,[-,-,-])\) be a semiheap. We say that a function \(\eta :S\rightarrow S\) is a warp if for all \(a,b,c\in S\),

$$\begin{aligned} \eta ([a,\eta (b),c])=[\eta (a),b,\eta (c)]. \end{aligned}$$

Similarly, we say \(\eta :S\rightarrow S\) is an antiwarp if for all \(a,b,c\in S\),

$$\begin{aligned} \eta ([a,\eta (b),c])=[\eta (c),b,\eta (a)]. \end{aligned}$$

Remark 3.4

If \((S,[-,-,-])\) is an abelian semiheap, then warps and antiwarps on \((S,[-,-,-])\) coincide.

Lemma 3.5

Let \((S,[-,-,-])\) be a semiheap. Then for any \(e\in S\), the shifts \(\rho _{ee}\) and \(\lambda _{ee}\) defined in (2.2) are warps.

Proof

Observe that for all \(a,b,c\in S\),

$$\begin{aligned}{} & {} \rho _{ee}([a,\rho _{ee}(b),c])=[[a,[b,e,e],c],e,e]\\{} & {} =[[a,e,e],b,[c,e,e]]=[\rho _{ee}(a),b,\rho _{ee}(c)]. \end{aligned}$$

Thus \(\rho _{ee}\) is a warp. Similarly one can show that \(\lambda _{ee}\) is a warp. \(\square \)

The following lemmas establish the connection between twists and warps.

Lemma 3.6

Let \((S,[-,-,-])\) be a semiheap and \(\eta :S\rightarrow S\) be a warp. Then \(S_\eta \) is a semiheap. In other words, warps are semiheap twists.

Proof

Simple check that for all \(a,b,c,d,e\in S\),

$$\begin{aligned}{} & {} [[a,b,c]_\eta , d,e]_\eta =[[a,\eta (b),c],\eta (d),e]\\{} & {} =[a,\eta (b),[c,\eta (d),e]]=[a,b,[c,d,e]_\eta ]_\eta , \end{aligned}$$

where the second equality follows by the associativity of \([-,-,-]\). Again, using associativity of \([-,-,-]\), we get that

$$\begin{aligned} \begin{aligned}&[[a,b,c]_\eta ,d,e]_\eta =[[a,\eta (b),c],\eta (d),e]\\&=[a,[\eta (d),c,\eta (b)],e]=[a,\eta ([d,\eta (c),b]),e]\\&=[a,\eta ([d,c,b]_\eta ),e]=[a,[d,c,b]_\eta , e]_\eta . \end{aligned} \end{aligned}$$

Thus, \((S,[-,-,-]_\eta )\) is a semiheap. \(\square \)

Although twists are more general than warps, under some conditions on the currying \(\mu \), see (2.2), we can obtain a sufficient condition for warps and twists to coincide in a given semiheap.

Lemma 3.7

Let \((S,[-,-,-])\) be a semiheap and assume there exist \( a,b\in S\) such that \(\mu _{ab}:S\rightarrow S\) is injective. Then \(S_\varphi \) is a semiheap if and only if \(\varphi \) is a warp.

Proof

If \(\varphi \) is a warp then by Lemma 3.6\((S,[-,-,-]_\varphi )\) is a semiheap. The opposite way, by the associativity of semiheaps \((S,[-,-,-]_\varphi )\) and \((S,[-,-,-])\), we get that for all \(c,d,e\in S\),

$$\begin{aligned} \begin{aligned}&[a,\varphi ([c,\varphi (d),e]),b]=[a,[c,d,e]_\varphi ,b]_{\varphi }=[[a,e,d]_\varphi ,c,b]_\varphi \\&=[[a,\varphi (e),d],\varphi (c),b]\\&=[a,[\varphi (c),d,\varphi (e)],b], \end{aligned} \end{aligned}$$

where the third equality follows by associativity of \([-,-,-]_\varphi \) and the fifth by the associativity of \([-,-,-]\). Now, since \(\mu _{ab}\) is injective we get that

$$\begin{aligned} \varphi ([c,\varphi (d),e])=[\varphi (c),d,\varphi (e)], \end{aligned}$$

hence \(\varphi \) is a warp. \(\square \)

The following lemmas provide us with a class of warps in abelian semiheaps.

Lemma 3.8

Let \((S,[-,-,-])\) be a semiheap. Then for any element \(e\in S\), the map is an antiwarp. When S is abelian \(\mu _{ee}\) is also a warp.

Proof

Simple observation that,

$$\begin{aligned} \begin{aligned}&\mu _{ee}([a,\mu _{ee}(b),c])=[e,[a,[e,b,e],c],e]\\&=[e,[[a,e,b],e,c],e]=[[e,c,e],[a,e,b],e]\\&=[[e,c,e],b,[e,a,e]]=[\mu _{ee}(c),b,\mu _{ee}(a)], \end{aligned} \end{aligned}$$

where the third equality follows by the associativity of S. When S is abelian, we get that

$$\begin{aligned}{}[\mu _{ee}(c),b,\mu _{ee}(a)]=[\mu _{ee}(a),b,\mu _{ee}(c)], \end{aligned}$$

and \(\mu _{ee}\) is a warp \(\square \)

Lemma 3.9

Let \((S,[-,-,-])\) be a semiheap and \(\mu _{ee}\) be surjective. Then \(\mu _{ee}\) is a warp if and only if S is abelian semiheap.

Proof

Observe, that if \(\mu _{ee}\) is a warp, then for all \(h,g,b\in S\) exist \(a,c\in S\) such that \(h=\mu _{ee}(a)\) and \(g=\mu _{ee}(c)\). The property of warp gives

$$\begin{aligned}{}[[e,a,e],b,[e,c,e]=[[e,c,e],b,[e,a,e]], \end{aligned}$$

and by putting h and g, we get

$$\begin{aligned}{}[h,b,g]=[g,b,h], \end{aligned}$$

so S is abelian semiheap. The converse follows by Lemma 3.8. \(\square \)

Lemma 3.10

Let \((S,[-,-,-])\) be a semiheap, \(\varphi \) be a warp on S and \(\psi \) be a warp on \(S_\varphi \). If \(\varphi \circ \psi =\psi \circ \varphi \), then \(\psi \circ \varphi \) is a warp on \((S,[-,-,-])\).

Proof

Let \(a,b,c\in S\), then

$$\begin{aligned} \begin{aligned}&\psi \circ \varphi ([a,\psi \circ \varphi (b),c])=\varphi \circ \psi ([a,\psi \circ \varphi (b),c])\\&=\varphi ([\psi (a),\varphi (b),\psi (c)])=[\varphi \circ \psi (a),b,\varphi \circ \psi (c)]\\&=[\psi \circ \varphi (a),b,\psi \circ \varphi (c)], \end{aligned} \end{aligned}$$

where second implication follows from the fact that \(\psi \) is a warp on \(S_\varphi \). Thus \(\psi \circ \varphi \) is a warp. \(\square \)

Corollary 3.11

Let \((S,[-,-,-])\) be a semiheap. Then if \(\varphi \) is a warp such that \(\varphi ^2=\textrm{Id}\) and there exists \(e\in S\) such that \(\varphi (e)=e\), then \(\mu _{ee}\circ \varphi =\varphi \circ \mu _{ee}\). That is, if S is abelian, \(\mu _{ee}\) is a warp.

Proof

Let \(a,e\in S\) be such that \(\varphi (e)=e\), then

$$\begin{aligned} \begin{aligned}&\varphi \circ \mu _{ee}(a)=\varphi ([e,a,e])=\varphi ([e,\varphi ^2(a),e])=[\varphi (e),\varphi (a),\varphi (e)]\\&=[e,\varphi (a),e]=\mu _{ee}(\varphi (a)). \end{aligned} \end{aligned}$$

\(\square \)

Lemma 3.12

Let \((S,[-,-,-])\) be a semiheap and \(\eta \) be a bijection and a warp. Then \(\eta ^{-1}\) is also a warp.

Proof

Let \(a,b,c\in S\) and observe that since \(\eta \) is a bijection there exist edf such that \(\eta (e)=a\), \(\eta (d)=b\) and \(\eta (f)=c\). Then

$$\begin{aligned}{} & {} \eta ^{-1}([a,\eta ^{-1}(b),c])=\eta ^{-1}([\eta (e),\eta ^{-1}(\eta (d)),\eta (f)])\\{} & {} \quad =\eta ^{-1}(\eta ([e,\eta (d),f]))=[\eta ^{-1}(a),b,\eta ^{-1}(c)]. \end{aligned}$$

Thus \(\eta ^{-1}\) is a warp. \(\square \)

Observe that since the inverse of the bijective warp is a warp, we get a criterion for the equivalence of semiheap structures on the same set.

Definition 3.13

We say that two semiheaps S and H are warp equivalent if there exists a sequence of bijective warps \((\varphi _i)_{i\in \{0,1,2,\ldots ,n\}}\), for \(n\in \mathbb {N}\), such that \(H=(((S_{\varphi _1})_{\varphi _2})\dots )_{\varphi _n}\), where \(\varphi _i\) is a warp of \(S_{\varphi _{i-1}}\) and \(\varphi _0=\textrm{Id}\).

Indeed the relation \(S\sim H\) if and only if S is warp equivalent to H is an equivalence relation on the set of all twists of S. Clearly \(S\sim S\), since the identity is a warp. The relation is a symmetric by Lemma 3.12 and transitivity follows trivially from the definition of warp equivalence.

Given the close connection between semigroups and semiheaps, see Example 2.4 and Theorem 2.6, we are compelled to consider a warp analogue for a semigroup.

Definition 3.14

Let \((S,\cdot )\) be a semigroup. We say that a function \(\varphi :S\rightarrow S\) is a switch if for all \(a,b,c\in G\),

$$\begin{aligned} \varphi (a\cdot \varphi (b)\cdot c)=\varphi (c)\cdot b\cdot \varphi (a). \end{aligned}$$

A semigroup equipped with a switch \((S,\cdot , \varphi )\) is called a switch semigroup.

Example 3.15

Let \((S,\circ ,1)\) be an abelian monoid and \(x\in S\) be an invertible element. Then is a switch on S.

Example 3.16

Let us consider natural numbers \(\mathbb {N}_0:=\mathbb {N}\setminus \{0\}\). Then for any \(k\in \mathbb {N}_0\) the map \(f_k(m):=k+m\), for all \(m\in \mathbb {N}_0\), is a switch.

Example 3.17

Any involuted semigroup \((S,\cdot ,*)\), in particular, any group taking \(*=(-)^{-1}\), is a switch semigroup since

$$\begin{aligned} (a\cdot b^*\cdot c)^*=c^* \cdot b \cdot a^*. \end{aligned}$$

We thus see that switch semigroups generalize involuted semigroups by relaxing the algebraic condition on the map \(\varphi \) from an antihomomorphic involution to the switch condition as defined above. The following lemma shows that the switch condition is, nevertheless, sufficient for a switch semigroup to induce a semiheap structure on the base set.

Lemma 3.18

Let \((S,\cdot )\) be a semigroup and \(\varphi :S\rightarrow S\) be a switch. Then \((S,[-,-,-]^\varphi )\), where \([a,b,c]^\varphi =a\cdot \varphi (b)\cdot c\) for all \(a,b,c\in S\), is a semiheap.

Proof

Let us check that associativity of semiheaps holds. Let \(a,b,c,d,e\in S\),

$$\begin{aligned}{}[[a,b,c]^\varphi ,d,e]^\varphi =a\cdot \varphi (b)\cdot c\cdot \varphi (d)\cdot e=[a,b,[c,d,e]^\varphi ]^\varphi \end{aligned}$$

and

$$\begin{aligned}\begin{aligned}{}[[a,b,c]^\varphi ,d,e]^\varphi&=a\cdot \varphi (b)\cdot c\cdot \varphi (d)\cdot e=a\cdot \varphi (d\cdot \varphi (c)\cdot b)\cdot e=a\cdot \varphi ([d,c,b]^\varphi )\cdot e\\ {}&=[a,[d,c,b]^\varphi ,e]^\varphi . \end{aligned} \end{aligned}$$

Thus \((S,[-,-,-]^\varphi )\) is a semiheap. \(\square \)

Moreover, we can state the analogue of Lemma 3.7 for semigroups.

Lemma 3.19

Let \((S,\cdot )\) be a semigroup and \(\varphi :S\rightarrow S\) be a function. If there exist \(l,r\in S\) such that functions and are injective, then \((S,[-,-,-]^\varphi )\), where \([a,b,c]^\varphi =a\cdot \varphi (b)\cdot c\) for all \(a,b,c\in S\), is a semiheap if and only if \(\varphi \) is a switch.

Proof

If \(\varphi \) is a switch, then \((S,[-,-,-]^\varphi )\) is a semiheap by Lemma 3.18.

In the opposite direction, let us assume \((S,[-,-,-]^\varphi )\) is a semiheap. Then by associativity of semiheap we get that for all \(a,b,c\in S\),

$$\begin{aligned} l\cdot \varphi (c\cdot \varphi (b)\cdot a)\cdot r=[l,[c,b,a]^\varphi ,r]^\varphi =[[l,a,b]^\varphi ,c,r]^\varphi =l\cdot \varphi (a)\cdot b\cdot \varphi (c)\cdot r. \end{aligned}$$

Now, since both maps \(l\cdot ,\cdot r:S\rightarrow S\) are injective, we get that

$$\begin{aligned} \varphi (c\cdot \varphi (b)\cdot a)=\varphi (a)\cdot b\cdot \varphi (c). \end{aligned}$$

Thus \(\varphi \) is a switch. \(\square \)

Example 3.20

Observe that assumptions of the Lemma 3.19 are quite strong. If we consider semigroup S with a constant binary operation , for a fixed c, then any function \(f:S\rightarrow S\) is a switch. Even though multiplications by any elements are not injective, we still get a semiheap \((S,[-,-,-]^f).\)

Example 3.21

If the semigroup S is abelian, then an identity is a switch. That is \((S,[-,-,-]^{\textrm{Id}})\) is a semiheap.

Lemma 3.22

Let \((S,[-,-,-])\) be a semiheap and \(e,a\in S\) such that \([e,a,x]=[a,e,x]=[x,e,a]=[x,a,e]\), for all \(x\in S\). Then \(\mu _{ee}\) is a switch for the semigroup .

Proof

Let \(x,y,z\in S\), then

where the second, third and fourth equalities follow by the associativity of a semiheap, the fifth uses the lemma assumption, and the seventh follows in a similar way using associativity and the assumption. Thus, \(\mu _{ee}\) is a switch for the semigroup . \(\square \)

In an abelian case switches and warps coincide, for a particular choice of ternary operation.

Lemma 3.23

Let \((S,\cdot )\) be an abelian semigroup.Then \(\varphi :S\rightarrow S\) is a switch if and only if \(\varphi \) is a warp of \((S,[-,-,-]^{\textrm{Id}})\).

Proof

If \(\varphi \) is a switch and \([a,b,c]^{\textrm{Id}}=a\cdot b\cdot c\), then

$$\begin{aligned} \varphi ([c,\varphi (b),a])=\varphi (c\cdot \varphi (b)\cdot a)=\varphi (c)\cdot b\cdot \varphi (a)=[\varphi (c),b,\varphi (a)], \end{aligned}$$

and \(\varphi \) is a warp.

If \(\varphi \) is a warp for \((S,[-,-,-]^{\textrm{Id}})\), then

$$\begin{aligned} \varphi (a\cdot \varphi (b)\cdot c)=\varphi ([a,\varphi (b),c])=\varphi ([c,\varphi (b),a])=[\varphi (c),b,\varphi (a)]=\varphi (c)\cdot b\cdot \varphi (a), \end{aligned}$$

where the second equality follows from the fact that S is an abelian semigroup. Thus \(\varphi \) is a switch \(\square \)

Lemma 3.24

Let \((S,[-,-,-])\) be an abelian semiheap and \(\varphi \) be a warp such that \(\varphi \) is an involution, that is \(\varphi ^2=\textrm{Id}\), and there exists \(e\in S\) such that \(\varphi (e)=e\). Then \(\varphi \) is a switch for the semigroup .

Proof

Let \(a,b,c\in S\), then

where the second equality follows by the fact that \(\varphi (e)=e\) and associativity of a semiheap, third and fourth uses warp property, and fifth follows by the involutivity of \(\varphi \). Thus, \(\varphi \) is a switch. \(\square \)

Proposition 3.25

Let \((S,\cdot ,1)\) be a monoid, \(\varphi :S\rightarrow S\) a switch and \(u\in S\) be such that \(\varphi (u)=1\). Then the following statements hold:

  1. (1)

    The switch \(\varphi \) is an involutive antihomomorphism of monoids if and only if \(u=1\).

  2. (2)

    The element \(u\in S\) is invertible with the inverse \(\varphi (1)\).

  3. (3)

    For all \(a,b\in S\), \(\varphi (a\cdot b)=\varphi (b)\cdot u\cdot \varphi (a)\) and \(\varphi (a)\cdot \varphi (b)=\varphi (b\cdot u^{-1}\cdot a)\).

  4. (4)

    For all \(a \in S\),

    $$\begin{aligned} \varphi (a)\cdot u^{-1}=\varphi (u^{-1}\cdot a), \qquad u^{-1}\cdot \varphi (a)=\varphi (a\cdot u^{-1}), \\ \varphi (u\cdot a)=\varphi (a)\cdot u, \qquad \varphi (a\cdot u)=u\cdot \varphi (a). \end{aligned}$$
  5. (5)

    For all \(n\in \mathbb {Z}\), \(\varphi (u^n)=u^{n-1}.\)

  6. (6)

    \(\varphi \) is a bijection.

Proof

(1). If \(u=1\), then \(\varphi (1)=1\) and for all \(a,b\in S\),

$$\begin{aligned} \varphi (a\cdot b)=\varphi (a\cdot \varphi (1)\cdot b)=\varphi (b)\cdot 1\cdot \varphi (a)=\varphi (b)\cdot \varphi (a) \end{aligned}$$

and

$$\begin{aligned} \varphi (\varphi (b))=\varphi (1\cdot \varphi (b)\cdot 1)=\varphi (1)\cdot b\cdot \varphi (1)=b. \end{aligned}$$

Thus, \(\varphi \) is an involutive antihomomorphism. Opposite follows by the fact that antihomomorphisms of monoids preserve an identity.

(2). Observe that \(\varphi (1)=u^{-1}\), since

$$\begin{aligned} u\cdot \varphi (1)=\varphi (u)\cdot u\cdot \varphi (1)=\varphi (u\cdot \varphi (u)\cdot 1)=\varphi (u)=1. \end{aligned}$$

Analogously from the right side, so \(\varphi (1)=u^{-1}\) and u is invertible.

(3). Let \(a,b\in S\), then

$$\begin{aligned} \varphi (a\cdot b)=\varphi (a\cdot 1\cdot b)=\varphi (a\cdot \varphi (u)\cdot b)=\varphi (b)\cdot u\cdot \varphi (a), \\ \varphi (a)\cdot \varphi (b)=\varphi (a)\cdot 1\cdot \varphi (b)=\varphi (b\cdot \varphi (1)\cdot a)=\varphi (b\cdot u^{-1}\cdot a). \end{aligned}$$

(4). Observe that by taking \(b=1\) and \(b=u\) in (3), respectively, we get that

$$\begin{aligned} \varphi (a)\cdot u^{-1}=\varphi (u^{-1}\cdot a)\quad \text {and}\quad \varphi (a\cdot u)=\varphi (u)\cdot u\cdot \varphi (a)=u\cdot \varphi (a). \end{aligned}$$

Similarly, by taking \(a=1\) and \(a=u\), we get the other two equalities. Thus (4) holds.

(5). Simply, by taking \(a=u^n\) for some \(n\in \mathbb {Z}\) in (4), we get that

$$\begin{aligned} \varphi (u^n)=\varphi (\underbrace{u^{sgn(n)}\cdot \ldots \cdot u^{sgn(n)}}_{|n|-times}\cdot 1)=\varphi (1)\cdot u^{sgn(n)|n|}=u^{-1}\cdot u^{n}=u^{n-1}, \end{aligned}$$

where sgn(n) is a sign of a number n and |n| is absolute value of n, that is \(sgn(n)|n|=n\).

(6). Let us consider a function . Then the composition \(\iota _u\circ \varphi \) is the inverse function of \(\varphi \). Indeed, for all \(a\in S\),

$$\begin{aligned}{} & {} \iota _u\circ \varphi \circ \varphi (a)=\iota _u(\varphi (1\circ \varphi (a)\circ 1))=\iota _u(\varphi (1)\cdot a\cdot \varphi (1))\\{} & {} = u\cdot \varphi (1)\cdot a\cdot \varphi (1)\cdot u=u\cdot u^{-1}\cdot a\cdot u^{-1}\cdot u=a, \end{aligned}$$

where second equality follows by the fact that \(\varphi \) is a switch and fourth follows by (2). \(\square \)

4 Biunit pairs

Our main goal in this section is to state and prove the generalized version of [19, Theorem 2.8] for biunit pairs, see Theorem 4.16. Let us start with the definition of biunit pairs.

Definition 4.1

[Biunit Pair cf. [11, 19, 20]] Let \((S,[-,-,-])\) be a semiheap and \(a,b\in S\). We say that the pair (ab) is a left (right) biunit pair if for all \(x\in S\)

$$\begin{aligned}{}[a,b,x]=x \qquad ([x,a,b]=x). \end{aligned}$$
(4.1)

If a pair is left and right biunit, we call it a biunit pair.

Note that for an element \(a\in S\) such that (aa) is a biunit pair we recover the definition of biunit element; biunit pairs are indeed parsimonious generalizations of biunit elements.

Example 4.2

Let us consider a set of odd integers \(\textrm{Odd}:=\{2n+1\ |\ n\in \mathbb {Z}\}\) together with a bracket \([-,-,-]:\textrm{Odd}^3\rightarrow \textrm{Odd}\) given for all \(a,b,c\in \textrm{Odd}\) by \([a,b,c]=a+b+c\). Obviously odd numbers are closed on the bracket operation. Moreover, an element is a biunit if and only if \(a+a+b=b\), which implies \(a=0\), however \(0\not \in \textrm{Odd}\). Now, observe that a pair \((a,-a)\) is a biunit pair for all \(a\in \textrm{Odd}\).

One may wonder at this point why the biunit condition, which can be stated as the fact that left and right shifts induced by the pair (ab) are the identity \(\lambda _{ab} = \text {id} = \rho _{ab}\), is not extended to also impose that the middle shift is the identity \(\mu _{ab}=\text {id}\). Examples below motivate this definition but, ultimately, our choice will be vindicated by the results derived in this section. We shall show that further assuming middle shifts to be the identity collapses the rich algebra induced by the choice of a pair of elements in a semiheap to generic semigroups without any extra structure.

Example 4.3

In the algebra of cubic matrices [21], the ternary operation on 3-index arrays of scalars (elements of a semiring in general) of size \(N\times N \times N\) defined by

$$\begin{aligned}{}[a,b,c]_{ijk}:=\sum _{p,q,r=1}^N a_{ijp}\cdot b_{qrp} \cdot c_{qrk} \end{aligned}$$

is easily checked to be a semiheap operation. The pair of special cubic matrices generalizing the identity matrix defined by

$$\begin{aligned} I_{ijk}=\delta _{ijk} \qquad \iota _{ijk}=\delta _{ik}, \end{aligned}$$

form a (right) biunit pair since we can directly compute:

$$\begin{aligned}{}[a,I,\iota ]_{ijk}=a_{ijk}=[a,\iota ,I]_{ijk}. \end{aligned}$$

Lemma 4.4

Let \((S,[-,-,-])\) be a semiheap. Then

  1. (1)

    If (ab) is a left (right) biunit pair then (ba) is a left (right) biunit pair.

  2. (2)

    For any \(a\in S\), if there exists \(b\in S\) such that (ab) is a biunit pair, then b is unique.

  3. (3)

    If (ab) is a left (right) biunit pair. Then if b is a right (left) biunit, then a is a left (right) biunit.

Proof

(1). Observe that if \((a,b)\in S\times S\) is a left biunit pair then \([a,b,b]=b\), and for all \(x\in S\),

$$\begin{aligned}{}[b,a,x]=[[a,b,b],a,x]=[a,[a,b,b],x]=[a,b,x]=x, \end{aligned}$$

thus (ba) is a left biunit pair. Similarly for the right case.

(2). Observe that if (ab) and \((a,b')\) are biunit pairs, then by (1) \((b',a)\) is a biunit pair and

$$\begin{aligned} b'=[b',a,b]=b. \end{aligned}$$

Thus b is unique.

(3). Let us assume that (ab) is a biunit pair and b is a right biunit. Then for all \(x\in S\)

$$\begin{aligned} x=[a,b,[b,a,x]]=[a,[a,b,b],x]=[a,a,x], \end{aligned}$$

so a is a left biunit. Proof for the right biunit pair is analogous. \(\square \)

Remark 4.5

Observe that the Lemma 4.4 allows us to weaken conditions in Lemma 3.22.

Lemma 4.6

Let S be a semiheap with a biunit pair (ab), then \(S_{\varphi }\), for a bijective warp \(\varphi \), also has a biunit pair, explicitly (ac), where \(\varphi (c)=b\).

Proof

Let (ab) be a biunit pair and \(\varphi \) be a bijective warp. Then there exists \(c\in S\) such that \(\varphi (c)=b\), and for all \(x\in S\)

$$\begin{aligned}{}[a,c,x]_\varphi =[a,\varphi (c),x]=[a,b,x]=x, \end{aligned}$$

and

$$\begin{aligned} \varphi ([x,a,c]_\varphi )=\varphi ([x,\varphi (a),c])=[\varphi (x),a,\varphi (c)]=\varphi (x). \end{aligned}$$

Observe that since \(\varphi \) is injective we get that

$$\begin{aligned}{}[x,a,c]_{\varphi }=[x,\varphi (a),c]=x, \end{aligned}$$

thus (ac) is a biunit in \(S_\varphi \). \(\square \)

Example 4.7

Observe that not all semiheap structures on the same base set are warp equivalent. Let us denote by \(\textrm{H}(\mathbb {Z})\) a heap \((\mathbb {Z},[-,-,-])\), where \([a,b,c]=a-b+c\) for all \(a,b,c\in \mathbb {Z}\), and by \(\textrm{H}(\mathbb {Z}_0)\) a semiheap, where \([a,b,c]=0\) for all \(a,b,c\in \mathbb {Z}\). Semiheaps \(\textrm{H}(\mathbb {Z})\) and \(\textrm{H}(\mathbb {Z}_0)\) are not warp equivalent as by Lemma 4.6, warp equivalence preserve biunit pairs.

Lemma 4.8

Let \((S,[-,-,-])\) be a semiheap with a biunit pair (ab). Then the set formed as closure under composition (but not inverse)

$$\begin{aligned} U:=\langle \textrm{Id}, \mu _{aa}, \mu _{bb}, \mu _{ab}, \mu _{ba} \rangle , \end{aligned}$$

where \(\mu \) are the middle shifts induced by the pair (ab), see (2.2), is a subgroup of the group \((\textrm{Aut}_{\textrm{Set}}(S),\circ )\).

Proof

Since all of the curryings of a pair of elements are endofunctions, it is enough to observe that all the generators are invertible. One can easily check that

$$\begin{aligned} \begin{aligned} \mu _{aa} \circ \mu _{bb}&= \mu _{ab}^2=\mu _{ba}^2 = \lambda _{ab} = \rho _{ab} = \textrm{Id}, \end{aligned} \end{aligned}$$

and \((U,\circ )\) is a group, thus it is a subgroup of \((\textrm{Aut}_{\textrm{Set}}(S),\circ )\). \(\square \)

Corollary 4.9

Observe that all the unary curryings induced by a biunit pair (ab) belongs to the set U. Moreover, S is warp equivalent to \(S_{\lambda _{aa}}\), \(S_{\lambda _{bb}}\), \(S_{\rho _{aa}}\) and \(S_{\rho _{bb}}\).

Proof

Observe that if (ab) is a biunit pair, then

$$\begin{aligned} \begin{aligned}&\mu _{aa} \circ \mu _{ab} = \mu _{ba} \circ \mu _{aa} = \rho _{aa},\qquad \mu _{bb} \circ \mu _{ba} = \mu _{ab} \circ \mu _{bb} = \rho _{bb},\\&\mu _{aa} \circ \mu _{ab} = \mu _{ba} \circ \mu _{aa} = \lambda _{aa},\qquad \mu _{bb} \circ \mu _{ba} = \mu _{ab} \circ \mu _{bb} = \lambda _{bb}, \end{aligned} \end{aligned}$$

thus \(\rho _{aa},\rho _{bb},\lambda _{aa},\lambda _{bb}\in U\). Since, by Lemma 3.5, all of those left and right shifts are warps and are invertible with inverses:

$$\begin{aligned} \lambda _{aa} \circ \lambda _{bb} = \rho _{aa} \circ \rho _{bb} = \textrm{Id}, \end{aligned}$$

we get that those are warp equivalences. \(\square \)

Lemma 4.10

Let \((S,[-,-,-])\) be a semiheap with a biunit pair (ac). Then curryings \(\mu _{ac}\) and \(\mu _{ca}\) are anti-automorphism of semigroups and . Moreover, is an anti-isomorphism of semigroups.

Proof

Indeed, let \(x,y\in S\), then

where third and fifth follows by the associativity of semiheap and the fourth one follows by the fact that (ac) is a biunit pair. Thus \(\mu _{ac}\) is an anti-endomorphism of the semigroup . Since \(\mu _{ac}\) is an involution, due to Lemma 4.8, \(\mu _{ac}\) is an automorphism. Proof for the semigroup is analogous. The case of \(\mu _{ca}\) can be proven the same way.

The second statement is observation that for all \(x,y\in S\),

Thus, \(\mu _{aa}\) is an anti-homomorphism, and by Lemma 4.8, it is an anti-isomorphism. \(\square \)

Lemma 4.11

The set of all biunit pairs of a semiheap \((S,[-,-,-])\) is a subsemiheap of the product semiheap \(S\times S\) with ternary operation given by \([(a,b),(c,d),(e,g)]:=([a,c,e],[b,d,g])\).

Proof

Let (ab), (cd) and (eg) be biunit pairs and \(x\in S\), then

$$\begin{aligned} \begin{aligned}&[[a,c,e],[b,d,g],x]=[[[a,c,e],g,d],b,x]\\&=[[a,c,[e,g,d]],b,x]=[[a,c,d],b,x]=[a,[b,d,c],x]\\&=[a,b,x]=x. \end{aligned} \end{aligned}$$

Thus ([ace], [bdg]) is a biunit pair. Associativity follows from the definition of a ternary operation on the product. \(\square \)

Corollary 4.12

The set \(\textrm{B}:=\{a\in S\ |\ \exists {b\in S} \ (a,b) \text {\ is\ a\ \ biunit\ pair}\}\) is a subsemiheap of S.

Lemma 4.13

Let \((S,[-,-,-])\) be a semiheap with a biunit pair (ab). Then \(\mu _{bb}\) is a switch for the semigroup and for all \(x,y,z\in S\) .

Proof

By Lemma 4.4, a biunit pair satisfies the conditions of Lemma 3.8. A biunit pair (ab) satisfy conditions in Lemma 3.22, and therefore \(\mu _{bb}\) is a switch for . The second claim is a simple observation that

\(\square \)

Corollary 4.14

If \((S,[-,-,-])\) is a semiheap with a biunit pair (ab), then is a monoid with an identity b and \(\mu _{bb}(b)\not =b\) in general, but \(\mu _{bb}(a)=b\). Thus, \(\mu _{bb}\) is a bijection and a is invertible by Proposition 3.25 (2) and (6) with inverse [bbb]. If \(\mu _{bb}(b)=b\), we get that b is the inverse of a, and a is a biunit.

Proposition 4.15

Let S be a semiheap with two different biunit pairs (ab) and (cd). Then monoids and are isomorphic. Moreover, switches \(\mu _{bb}\) and \(\mu _{dd}\) are related by equation

$$\begin{aligned} \lambda _{da}\circ \mu _{bb}=\mu _{dd}\circ \lambda _{ad}^{-1}. \end{aligned}$$

Proof

Let us check that \(\lambda _{da}\) is an isomorphism of monoids. Indeed for all \(x,y\in S\),

For the second statement, observe that \(\lambda _{cb}=\lambda _{ad}^{-1}\) as for all \(x\in S\),

$$\begin{aligned} \lambda _{cb}\circ \lambda _{ad}(x)=[c,b,[a,d,x]]=[[c,b,a],d,x]=[c,d,x]=x. \end{aligned}$$

Now,

$$\begin{aligned} \lambda _{da}\circ \mu _{bb}(x)=[d,a,[b,x,b]]=[d,x,b]=[d,x,[d,c,b]]\\ =\mu _{dd}\circ \lambda _{cb}=\mu _{dd}\circ \lambda _{ad}^{-1}. \end{aligned}$$

\(\square \)

We are now ready to prove our main theorem extending the classic result by Wagner [19, Theorem 2.8] stated in Theorem 2.6.

Theorem 4.16

Let \((S,\cdot ,1)\) be a monoid and \(\varphi \) be a bijective switch. Then a pair \((\varphi ^{-1}(1),1)\) is a biunit pair in the semiheap \((S,[-,-,-]^{\varphi })\). Furthermore, every semiheap S with a biunit pair (ab) is a monoid with a bijective switch \(\mu _{bb}\).

Proof

The second part is Lemma 4.13 and Corollary 4.14. For the first part, \((S,[-,-,-]^\varphi )\) is a semiheap by Lemma 3.18, so it is enough to check that \((\varphi ^{-1}(1),1)\) is a biunit pair. Indeed, observe that for all \(c\in S\),

$$\begin{aligned}{}[\varphi ^{-1}(1),1,c]^\varphi =\varphi ^{-1}(1)\cdot \varphi (1)\cdot c=c=c\cdot \varphi (1)\cdot \varphi ^{-1}(1)=[c,1,\varphi ^{-1}(1)]^\varphi , \end{aligned}$$

where \(\varphi (1)\) is the inverse of \(\varphi ^{-1}(1)\) by the Proposition 3.25 (2). By Lemma 4.4 (1) it is enough to check just this one equality. \(\square \)

Corollary 4.17

There is a one-to-one correspondence between semiheaps with a chosen biunit pair and monoids with a bijective switch:

$$\begin{aligned} \{ \text {semiheap} + \text {biunit} \,\, \text {pair} \} \rightleftharpoons \{\text {monoid} + \text {bijective} \,\, \text {switch}\} \end{aligned}$$

which is realized explicitly via the assignments:

Proof

It is enough to show that \(\Lambda =\Omega ^{-1}\). Indeed, let us consider

Observe that for all \(x,y,z\in S\),

and

$$\begin{aligned} \mu _{bb}^{-1}(b)=\mu _{aa}(b)=a, \end{aligned}$$

where \([-,-,-]\) is the ternary operation of S. Thus , and \(\Omega \) is a right inverse of \(\Lambda \).

For the left inverse, we have \(\Omega (\Lambda (M,\cdot ,1,\varphi ))=\Omega (M,[-,-,-]^{\varphi },(\varphi ^{-1}(1),1))\). Let us denote \(e:=\varphi ^{-1}(1)\), observe that for all \(x,y\in M\),

1 is the identity from the definition of \(\Omega \), and

$$\begin{aligned} \mu _{11}(x)=1\cdot \varphi (x)\cdot 1=\varphi (x). \end{aligned}$$

Thus \(\Omega ((M,[-,-,-]^{\varphi }),(\varphi ^{-1}(1),1))=(M,\cdot ,1,\varphi )\), and \(\Omega \) is a right inverse to \(\Lambda \). Therefore \(\Lambda \) is a bijection and we have one-to-one correspondence. \(\square \)

These results motivate the definition of the family of semiheaps whose elements belong to biunit pairs.

Definition 4.18

A semiheap \((D,[-,-,-])\) in which for every element \(a\in D\) there exists \(b\in D\) such that (ab) is a biunit pair, is called a diheap.

Example 4.19

Any abelian group \((A,+)\) has an associated abelian semiheap structure \((A,[-,-,-])\) given by \([a,b,c]:=a+b+c\). The inverse map ensures that all elements \(a\in A\) are in a pair \((a,-a)\) satisfying:

$$\begin{aligned}{}[a,-a,x]=a-a+x=x=x+a-a=[x,a,-a] \end{aligned}$$

and thus \((A,[-,-,-])\) is a diheap that otherwise fails to be a heap in general.

It follows from this definition that diheaps generalize heaps. In fact, there is a deep connection between diheaps and heaps via twisting.

Proposition 4.20

A diheap \((D,[-,-,-])\) is warp equivalent to a heap \(D_\psi \), where \(\psi \) is an involutive semiheap automorphism, and thus a warp.

Proof

Let \(a,b,c,d\in D\) and let us denote by \(\hat{a}\), a second component of a biunit pair, that is an element of D such that \((a,\hat{a})\) is a biunit pair. Then, from Lemma 4.4 we get that the map \(\psi (a):=\hat{a}\) is a well-defined function and an involution. The only thing to check is that \(\psi \) is a warp. Observe that

$$\begin{aligned}{}[[a,b,c],[\hat{a},\hat{b},\hat{c}],d]=[[a,b,[c,\hat{c},\hat{b}]],\hat{a},d]=d. \end{aligned}$$

Thus \(\widehat{[a,b,c]}=[\hat{a},\hat{b},\hat{c}]\) and

$$\begin{aligned} \psi ([a,\psi (b),c])=\widehat{[a,\hat{b},c]}=[\hat{a},\hat{\hat{b}},\hat{c}]=[\hat{a},b,\hat{c}]=[\psi (a),b,\psi (c)]. \end{aligned}$$

Therefore \(\psi \) is a warp, and one can easily check that every element in \(D_\psi \) is a biunit. Thus, D is warp equivalent to a heap. \(\square \)

Note that if the diheap \((D,[-,-,-])\) in Proposition 4.20 above is a heap, i.e. all biunit pairs are of the form (aa) for \(a\in D\), then the induced involutive semiheap automorphism is simply the identity \(\psi =\text {id}_D\). This suggest that heaps and diheaps are distinct classes of semiheaps, as we can indeed confirm.

Proposition 4.21

Considered as semiheaps, a diheap is isomorphic to a heap if and only if it is, itself, a heap.

Proof

Firstly, observe that any surjective homomorphism \(\varphi :D\rightarrow S\), for some semiheaps D and S, preserve biunit pairs. Indeed, if (ab) is a biunit pair in D, then for all \(y\in S\) exists \(x\in D\) such that \(\varphi (x)=y\) and

$$\begin{aligned}{}[\varphi (a),\varphi (b),y]=\varphi ([a,b,x])=\varphi (x)=y=\varphi (x)=\varphi ([x,a,b])=[y,\varphi (a),\varphi (b)]. \end{aligned}$$

Thus \((\varphi (a),\varphi (b))\) is a biunit pair in S. Now, if D is a diheap which is not a heap, i.e. there exists at least one biunit pair (ab) such that \(a\ne b\), and S is a heap, it follows that \(\varphi (a)=\varphi (b)\) thus \(\varphi \) fails to be injective. Conversely, if diheap is a heap, it is isomorphic to itself. \(\square \)

Diheaps thus appear as a well-motivated novel class of semiheaps that strictly generalizes heaps. This poses some intriguing lines of further enquiry. Although we have shown that diheaps are generally non-isomorphic to heaps, one can ask whether there exists a different category of semiheaps where warp equivalence corresponds to isomorphism. It seems plausible that the diheaps induced from invertible structures as in Example 4.19 are essentially the only class of non-heap diheaps. Following Theorem 4.16, diheaps correspond to a particular class of switch monoids, it will be interesting to consider whether such class of algebras has been identified before or whether it may have some application in semigroup research.