Rings and Boolean Algebras as Algebraic Theories Arturo De Faveri Abstract . We present a unified framework for representing commutative rings through affine algebraic theories and Boolean rings through hyperaffine algebraic theories. This yields categorical equivalences between these theories and, respectively, commutative rings and Boolean rings. We then analyse models of affine theories over a Boolean ring B B , comparing them with the models of hyperaffine theories, the well-known B B -sets. Two novel characterisations are presented: the first defines these models as Boolean vector spaces equipped with an action of the Boolean ring; the second provides a representation in terms of sheaves, in analogy with B B -sets. Finally, we establish a connection between hyperaffine theories and multidimensional Boolean algebras, a recently introduced generalisation of Boolean algebras. 1. Introduction An algebraic theory (also called a clone ) is an abstraction of the notion of algebraic operations and the equations they satisfy. In universal algebra, an equational class of algebras is specified by a signature of operations and a set of equational identities. An algebraic theory T encodes the same information in different terms: it is a collection of abstract operations of finite arities together with a rule for their composition. An algebra of the theory T is then a set equipped with actual operations corresponding to the elements of the theory, in such a way that composition is respected. Given an algebraic structure, a natural and intriguing question is how to represent it as an algebraic theory. In this paper we focus on rings, and we ask whether there exists a full embedding F:\mathbf{Ring}\to\mathbf{AlgTh} of the category of rings into that of algebraic theories such that suitable abstract properties of the theory F(R) enable to reconstruct perfectly the ring R . The first idea that comes to mind is to associate with R the theory F(R) of (left) R -modules. The abstract operations, in this case, are the tuples (r_{1},\ldots,r_{n})\in R^{n} , thought of as linear combinations r_{1}x_{1}+\cdots+r_{n}x_{n} . If the ring is commutative, then all the abstract operations are commutative. Two binary operations s,r are said to commute if (1.1) r(s(x,y),s(z,w))=s(r(x,z),r(y,w))\text{,} and this condition can be generalised to higher arities. However, if the goal is to reconstruct R from abstract properties like ( 1.1 ), the encoding of R via R -modules is not sufficiently rich. It turns out that there are two orthogonal constructions that allow us to reconstruct R perfectly and these two constructions have in common the idea of encoding the ring through the binary operations of the corresponding theory. The first, which works in the case of a commutative ring, associates with R the theory of affine R -modules, namely the theory whose operations are linear combinations r_{1}x_{1}+\cdots+r_{n}x_{n} such that r_{1}+\cdots+r_{n}=1 . The operations of this theory are commutative and idempotent. The second construction, specific to Boolean rings, associates with a Boolean ring B the theory of “hyperaffine” B -modules, that is, the theory whose operations are linear combinations b_{1}x_{1}+\cdots+b_{n}x_{n} such that b_{1}+\cdots+b_{n}=1 and b_{i}b_{j}=0 for i\neq j . In this case, a strong property holds (1.2) b(b(x,y),b(z,w))=b(x,w)\text{,} making each binary operation a rectangular band. These observations can be crystallised in the following statement: for every commutative (resp. Boolean) ring R , the theory of affine (resp. “hyperaffine”) R -modules is affine (resp. hyperaffine); moreover, any affine (resp. hyperaffine) theory is uniquely determined by the ring of its binary operations (cf. Theorems 3.7 and 3.14 ). Our first main contribution is the development of a convenient framework in which the “hyperaffine” and “affine” constructions can be realised. We first provide a new proof that hyperaffine theories form a category equivalent to that of Boolean rings. This result was originally stated in [ 10 , Theorem 4.9] . We then apply the same strategy to show in Theorem 3.14 that affine theories correspond precisely to commutative rings. We highlight the importance of the role played by the coefficients of a theory to the end of presenting both constructions in a single, coherent setting. Given a Boolean ring B , as B is commutative, we have two ways of encoding B as an algebraic theory: either as a hyperaffine theory or as an affine theory. Models of hyperaffine theories are known to be B -sets [ 2 ] , so that we are led to the question: what are the models of an affine theory whose ring of coefficients is Boolean? Our second main contribution is the answer to this question. We provide two characterisations for the models of an affine theory over a Boolean ring B . The first, Theorem 5.7 , is purely algebraic: the models of an affine theory over a Boolean ring are Boolean vector spaces equipped with a compatible action of B which is idempotent and commutative. The second, Theorem 5.9 , shows that these structures admit a sheaf representation analogous to B -sets (see [ 2 ] ). Inspired by the representation of Boolean algebras through a ternary “conditional disjunction” operation (if-then-else), some authors have recently introduced n -dimensional Boolean algebras ( n BAs), featuring an (n+1) -ary operation q and n constants e_{1},\ldots,e_{n} [ 7 , 6 , 24 ] . These structures provide the algebraic semantics for a many-valued logic with symmetric truth values e_{1},\ldots,e_{n} . We highlight a connection between hyperaffine algebraic theories and n BAs. We prove in Theorem 4.2 that every hyperaffine theory T naturally induces an n BA structure on the set of its n -ary operations; conversely, a coherent sequence of n BAs uniquely determines a hyperaffine theory. This link originates from the dual interpretation of the (n+1) -ary operator q , viewed on the one hand as a composition operator, and on the other as a generalised if-then-else. In [ 7 ] , it is shown that n BAs are related to skew Boolean algebras [ 16 ] . These considerations suggest that, in the affine case, the corresponding theories naturally point toward the introduction of suitable notions of n -dimensional commutative rings and skew rings, in analogy with the Boolean case. 1.1. Related works. Hyperaffine theories were introduced by Johnstone [ 14 ] in the context of a theorem providing necessary and sufficient syntactic conditions for a variety of algebras to form a cartesian closed category. This result has since been elegantly revisited, opening up new perspectives and developments [ 10 , 11 ] . Among other contributions, [ 10 ] offers a detailed account of the connection between hyperaffine theories and their models, namely B -sets. More about B -sets can be found in [ 27 , 28 ] . On the other hand, models of affine theories essentially capture what the Polish school calls Mal’cev modes [ 23 ] , culminating a long line of research on varieties of affine modules [ 25 , 8 , 29 , 22 ] . The models of hyperaffine theories are connected with the algebraic treatment of the if-then-else construct, a topic that has been extensively studied in the semantics of programming languages [ 19 , 20 , 21 , 13 ] . 1.2. Outline of the paper. Section 2 introduces the preliminary material on algebraic theories. Section 3 is divided into two main parts. In the first, it is shown that hyperaffine theories form a category equivalent to that of Boolean rings. In the second part, we apply the previously developed blueprint to show that affine theories, by contrast, correspond to commutative rings. Section 4 explores the link between hyperaffine theories and n -dimensional Boolean algebras. Section 5 is devoted to the study of the models of these theories, with particular attention to the models of affine theories when the ring of coefficients is Boolean. Finally, Section 6 wraps up with concluding remarks and directions for future work. 2. Varieties and algebraic theories In a broad sense, a variety is the category of models of a finitary and one-sorted equational theory. A given variety may be axiomatised by operations and equations in many ways; however, there is always a canonical choice, which is captured by the notion of algebraic theory due to Lawvere [ 15 ] (see also [ 3 , Section 3] and [ 1 , Chapter 11] ). Here we give a formulation of algebraic theory essentially equivalent to what universal algebraists call an abstract clone [ 30 ] . Definition 2.1 . An algebraic theory T is a family of sets T(n) , for each n\in\mathbb{N} , together with elements \pi^{n}_{i}\in T(n) , 1\leq i\leq n , and a composition operator \circ:T(n)\times T(m)^{n}\to T(m) , for each m,n\in\mathbb{N} . These data have to satisfy, writing f(g_{1},\ldots,g_{n}) in place of f\circ(g_{1},\ldots,g_{n}) , two unit laws for 1\leq i\leq n (2.1) \pi^{n}_{i}(g_{1},\ldots,g_{n})=g_{i}\quad\text{ and }\quad f(\pi^{n}_{1},\ldots,\pi^{n}_{n})=f and the associative law (2.2) f(g_{1}(h_{1},\ldots h_{m}),\ldots,g_{n}(h_{1},\ldots,h_{m}))=f(g_{1},\ldots,g_{n})\circ(h_{1},\ldots h_{m})\text{.} We call an element of T(n) an n -ary operation in T . Definition 2.2 . A morphism of theories \varphi:T\to T^{\prime} comprises, for every n , a function \varphi:T(n)\to T^{\prime}(n) satisfying (2.3) \varphi(\pi^{n}_{i})=\pi^{n}_{i}\text{ for }1\leq i\leq n\text{ and }\varphi(f(g_{1},\ldots,g_{n}))=\varphi(f)(\varphi(g_{1}),\ldots,\varphi(g_{n})) for all f\in T(n) and g_{1},\ldots,g_{n}\in T(m) . Definition 2.3 . A model or an algebra for an algebraic theory T is a set X together with, for each n\in\mathbb{N} , a left action \cdot:T(n)\times X^{n}\to X satisfying two conditions: (2.4) \pi^{n}_{i}\cdot(x_{1},\ldots,x_{n})=x_{i} for all 1\leq i\leq n , and (2.5) f(g_{1},\ldots,g_{n})\cdot(x_{1},\ldots,x_{m})=f\cdot(g_{1}\cdot(x_{1},\ldots,x_{m}),\ldots,g_{n}\cdot(x_{1},\ldots,x_{m})) for each f\in T(n),g_{1},\ldots,g_{n}\in T(m),x_{1},\ldots,x_{m}\in X . The category of models of a theory is called an algebraic variety . For each m , the set T(n) is a model with action \cdot:T(n)\times T(m)^{n}\to T(n)\quad\text{ given by }\quad\circ:T(n)\times T(m)^{n}\to T(n)\text{.} We call T(m) the free model on n generators. There is an obvious forgetful functor from the category of models of T to the category of sets, associating with the model X its underlying set X . The underlying set of the free model on n generators is T(n) . In this light, we can freely identify the operation f\in T(n) with the element f(x_{1},\ldots,x_{n}) in the free model on the n generators x_{1},\ldots,x_{n} . The initial theory S is such that S(n) contains only the n projections \pi^{n}_{i} for n\geq 1 and S(0) is empty; models of S are mere sets. The terminal theory U is given by U(n)=\{*\} for all n and its only model is the singleton. The terminal theory has a subtheory U^{\prime} (i.e., there is an injective morphism U^{\prime}\to U ) given by U^{\prime}(n)=\begin{cases}\varnothing&\text{ if }n=0\\ \{*\}&\text{ if }n\neq 0\text{,}\end{cases} whose models are either the empty set or the singleton. We refer to U and to U^{\prime} as the two degenerate theories. 2.1. Mal’cev operations, affine and hyperaffine theories. We recall the following well-known definitions. Definition 2.4 . Let T be an algebraic theory; f\in T(n) is said to • be idempotent if f(x,\ldots,x)=x ; • split if f(f(x^{1}_{1},\ldots x^{1}_{n}),\ldots,f(x^{n}_{1},\ldots,x^{n}_{n}))=f(x^{1}_{1},\ldots,x^{n}_{n})\text{.} An idempotent, splitting operation is called a decomposition operation . Moreover, f\in T(n) and g\in T(m) are said to commute if f(g(x^{1}_{1},\ldots x^{1}_{m}),\ldots,g(x^{n}_{1},\ldots x^{n}_{m}))=g(f(x^{1}_{1},\ldots x^{n}_{1}),\ldots,f(x^{1}_{m},\ldots x^{n}_{m}))\text{.} A theory is idempotent (resp. commutative ) if every operation is (resp. if every pair of operations commute). Another essential ingredient in the paper is that of a Mal’cev operation. Roughly speaking, a Mal’cev operation in a commutative theory generalises the operation f(x,y,z)=x-y+z in Abelian groups. The importance of this concept lies in the fact that the presence of a Mal’cev operation in a theory is reflected in the internal structure of its models: given two congruences R , S on a model X of T , their composition R\circ S commutes, meaning that R\circ S=S\circ R , iff T(3) has a Mal’cev operation. Formally, a Mal’cev operation is defined as follows; for an exhaustive and much more general treatment we refer the reader to [ 26 , 4 ] . Definition 2.5 . Let T be an algebraic theory. An element p\in T(3) is called a Mal’cev operation if x=p(x,y,y)\quad\text{ and }\quad p(x,x,y)=y\text{.} Lemma 2.6 . Let p\in T(3) be a Mal’cev operation that commutes with itself. Then p satisfies M1: p(x,y,p(t,u,v))=p(p(x,y,t),u,v) ; M2: p(x,y,z)=p(z,y,x) . Moreover, if p and p^{\prime} are two Mal’cev operations in T(3) which commute with each other, then they coincide. Proof. Firstly, we prove (M1) \displaystyle p(x,y,p(t,u,v)) \displaystyle=p(p(x,z,z),p(y,z,z),p(t,u,v)) \displaystyle=p(p(x,y,t),p(z,z,u),p(z,z,v)) \displaystyle=p(p(x,y,t),u,v)\text{.} Then we prove (M2) \displaystyle p(x,y,z) \displaystyle=p(p(z,y,x),p(z,y,x),p(x,y,z)) \displaystyle=p(z,y,p(x,p(z,y,x),p(x,y,z))) (M1) \displaystyle=p(z,y,p(p(z,z,x),p(z,y,x),p(x,y,z))) \displaystyle=p(z,y,p(p(z,z,x),p(z,y,y),p(x,x,z))) \displaystyle=p(z,y,p(x,z,z)) \displaystyle=p(z,y,x)\text{.} Finally, let p and p^{\prime} be two Mal’cev operations that commute with each other. Then \displaystyle p(x,y,z) \displaystyle=p(p^{\prime}(x,y,y),p^{\prime}(y,y,y),p^{\prime}(y,y,z)) \displaystyle=p^{\prime}(p(x,y,y),p(y,y,y),p(y,y,z)) \displaystyle=p^{\prime}(x,y,z) concluding the proof. ∎ Definition 2.7 . We call affine 1 1 1 Note that this terminology is slightly non-standard and some authors use the word ‘affine’ to denote what we call idempotent theories. an idempotent, commutative theory T with a Mal’cev operation p\in T(3) . Moreover, following [ 14 , Section 4] we call hyperaffine an idempotent, commutative theory in which every operation splits. The two degenerate theories U and U^{\prime} are affine and hyperaffine. Remark 2.8 . An algebra whose operations are idempotent and commutative is called a mode [ 23 ] . Therefore, models of an affine theory form an algebraic variety of modes. The same applies to a hyperaffine theory. The following distributive property will be useful later. Lemma 2.9 . Let T be a hyperaffine theory. Then for f\in T(k) and g_{1},\ldots,g_{k}\in T(n) , (2.6) \begin{split}f(g_{1},\ldots,g_{k})&\circ(f(x^{1}_{1},\ldots,x^{k}_{1}),\ldots,f(x^{1}_{n},\ldots,x^{k}_{n}))\\ &=f(g_{1}(x^{1}_{1},\ldots,x^{1}_{n}),\ldots,g_{k}(x^{k}_{1},\ldots,x^{k}_{n}))\text{.}\end{split} Moreover, if an idempotent theory T satisfies ( 2.6 ), then T is hyperaffine. Proof. We prove ( 2.6 ) \displaystyle f(g_{1},\ldots,g_{k})\circ(f(x^{1}_{1},\ldots,x^{k}_{1}),\ldots,f(x^{1}_{n},\ldots,x^{k}_{n})) \displaystyle=f(g_{1}(f(x^{1}_{1},\ldots,x^{k}_{1}),\ldots,f(x^{1}_{n},\ldots,x^{k}_{n})),\ldots,g_{k}(f(x^{1}_{1},\ldots,x^{k}_{1}),\ldots,f(x^{1}_{n},\ldots,x^{k}_{n}))) \displaystyle=f(f(g_{1}(x^{1}_{1},\ldots,x^{1}_{n}),\ldots,g_{1}(x^{k}_{1},\ldots,x^{k}_{n})),\ldots,f(g_{k}(x^{1}_{1},\ldots,x^{1}_{n}),\ldots,g_{k}(x^{k}_{1},\ldots,x^{k}_{n}))) \displaystyle=f(g_{1}(x^{1}_{1},\ldots,x^{1}_{n}),\ldots,g_{k}(x^{k}_{1},\ldots,x^{k}_{n}))\text{.} Now, assume that T satisfies ( 2.6 ). Firstly, every f\in T(n) splits \displaystyle f(f(x^{1}_{1},\ldots,x^{n}_{1}),\ldots,f(x^{1}_{n},\ldots,x^{n}_{n})) \displaystyle=f(\pi^{n}_{1},\ldots,\pi^{n}_{n})\circ(f(x^{1}_{1},\ldots,x^{n}_{1}),\ldots,f(x^{1}_{n},\ldots,x^{n}_{n})) \displaystyle=f(\pi^{n}_{1}(x^{1}_{1},\ldots,x^{n}_{1}),\ldots,\pi^{n}_{n}(x^{1}_{n},\ldots,x^{n}_{n})) ( 2.6 ) \displaystyle=f(x^{1}_{1},\ldots,x^{n}_{n})\text{.} Finally, every f\in T(n) and g\in T(m) commute \displaystyle f(g(x^{1}_{1},\ldots x^{1}_{m}),\ldots,g(x^{n}_{1},\ldots x^{n}_{m})) \displaystyle=f(g,\ldots,g)\circ(f(x^{1}_{1},\ldots x^{n}_{1}),\ldots,f(x^{1}_{m},\ldots x^{n}_{m})) ( 2.6 ) \displaystyle=g(f(x^{1}_{1},\ldots x^{n}_{1}),\ldots,f(x^{1}_{m},\ldots x^{n}_{m})) proving the claim. ∎ 3. Representing rings as algebraic theories A ring is a tuple (R,+,0,\cdot,1) such that (R,+,0) is an Abelian group, (R,\cdot,1) is a multiplicative monoid and multiplication distributes over addition: r(a+b)=ra+rb and (a+b)r=ar+br for all a,b,r\in R . The ring R is said to be commutative if the monoid is, and Boolean if r^{2}=r for every r\in R . A Boolean ring is necessarily commutative. Any ring R gives rise to an algebraic theory T_{R} as follows. For n\in\mathbb{N} , let T_{R}(n) be the set of tuples (r_{1},\ldots,r_{n})\in R^{n} . These are the abstract n -ary operations of the theory. The projections in T_{R}(n) are given by the standard basis of R^{n} : (1,0,\ldots,0),\ldots,(0,\ldots,0,1) , while composition \circ:T_{R}(n)\times T_{R}(m)^{n}\to T_{R}(m) is given by matrix multiplication: \begin{bmatrix}r_{1}\\ \vdots\\ r_{n}\\ \end{bmatrix}\circ\begin{bmatrix}a^{1}_{1}&\cdots&a^{n}_{1}\\ \vdots&\ddots&\vdots\\ a^{1}_{m}&\cdots&a^{n}_{m}\end{bmatrix}=\begin{bmatrix}a^{1}_{1}r_{1}+\cdots+a^{n}_{1}r_{n}\\ \vdots\\ a^{1}_{m}r_{1}+\cdots+a^{n}_{m}r_{n}\end{bmatrix} Models of the theory T_{R} are precisely (left) modules over the ring R . 3.1. Hyperaffine theories We start by examining the case of hyperaffine theories. Definition 3.1 . For a given Boolean ring B , we define the algebraic theory H_{B} whose operations in H_{B}(n) are (b_{1},\ldots,b_{n})\in B^{n} such that b_{1}+\cdots+b_{n}=1 and b_{i}b_{j}=0 for i\neq j . Projections are given by the standard basis of B^{n} and composition is defined by matrix multiplication as above. Boolean rings can be equivalently described as Boolean algebras defining a\land b:=ab , a\lor b=a+(1-a)b , \lnot a:=1-a . We will freely switch between the two descriptions, because some results are better expressed in terms of Boolean algebras. Note that, if ab=a\land b=0 , then a+b=a\lor b . As a consequence, the operations in H_{B}(n) are (b_{1},\ldots,b_{n})\in B^{n} such that b_{1}\lor\cdots\lor b_{n}=1 and b_{i}\land b_{j}=0 for i\neq j . Observe that H_{B}(0)=\varnothing unless B is degenerate, that is 0=1 , in which case H_{B}(0)=\{*\} . Lemma 3.2 . Let B be a Boolean ring. The algebraic theory H_{B} is hyperaffine. Proof. As B is commutative, H_{B} is commutative. Idempotence is ensured by the condition b_{1}+\cdots+b_{n}=1 : for every (b_{1},\ldots,b_{n})\in H_{B}(n) and (a_{1},\ldots,a_{m})\in H_{B}(m) \begin{bmatrix}b_{1}\\ \vdots\\ b_{n}\end{bmatrix}\circ\begin{bmatrix}a_{1}&\cdots&a_{1}\\ \vdots&\ddots&\vdots\\ a_{m}&\cdots&a_{m}\end{bmatrix}=\begin{bmatrix}a_{1}(b_{1}+\cdots+b_{n})\\ \vdots\\ a_{m}(b_{1}+\cdots+b_{n})\end{bmatrix}=\begin{bmatrix}a_{1}\\ \vdots\\ a_{m}\\ \end{bmatrix} The fact that b_{i}^{2}=b_{i} for all i and b_{i}b_{j}=0 for i\neq j precisely yields that every operation splits: \begin{bmatrix}b_{1}\\ \vdots\\ b_{n}\\ \end{bmatrix}\circ\begin{bmatrix}a^{1}_{11}b_{1}+\cdots+a^{1}_{n1}b_{n}&\cdots&a^{n}_{n1}b_{1}+\cdots+a^{n}_{n1}b_{n}\\ \vdots&\ddots&\vdots\\ a^{1}_{1m}b_{1}+\cdots+a^{1}_{nm}b_{n}&\cdots&a^{n}_{1m}b_{1}+\cdots+a^{n}_{nm}b_{n}\end{bmatrix}=\begin{bmatrix}a^{1}_{11}b_{1}+\cdots+a^{n}_{n1}b_{n}\\ \vdots\\ a^{1}_{1m}b_{1}+\cdots+a^{n}_{nm}b_{n}\end{bmatrix} for all (b_{1},\ldots,b_{n})\in H_{B}(n) . ∎ Recall that we identify f\in T(n) with the element f(x_{1},\ldots,x_{n}) in the free model on n generators. Lemma 3.3 . [ 10 , Proposition 4.4] Let T be a hyperaffine theory. Then the set T(2) is a Boolean algebra with the operations defined as follows, for every a(x,y),b(x,y)\in T(2) : • (a\land b)(x,y):=a(b(x,y),y) ; • (a\lor b)(x,y):=a(x,b(x,y)) ; • (\lnot a)(x,y):=a(y,x) ; • 0(x,y):=y and 1(x,y):=x . When the Boolean ring B is degenerate, we have that H_{B}=U , the degenerate theory. Johnstone [ 14 , p. 461] introduced the notion of coefficient to prove that, if H_{n} is the hyperaffine theory generated by a single operation of arity n , then the category of models of H_{n} is equivalent to the product \mathbf{Set}^{n} . The notion of coefficient will play a central role in what follows. Definition 3.4 . Let T be an algebraic theory, and let f\in T(n) . We call the following elements of T(2) coefficients of f : f[1](x,y):=f(x,y,\ldots,y),\ldots,f[n](x,y):=f(y,\ldots,y,x)\text{.} The next proposition shows in particular the fact that any operation in a hyperaffine theory is completely determined by its coefficients. Proposition 3.5 . Let T be a hyperaffine theory and let B be the Boolean ring T(2) . The following hold: (1) if f\in T(n) , then f[1]\lor\cdots\lor f[n]=1 and f[i]f[j]=0 for i\neq j ; (2) for f,g\in T(n) , if f[i]=g[i] for all 1\leq i\leq n , then f=g ; (3) for every (b_{1},\ldots,b_{n}) such that b_{1}\lor\cdots\lor b_{n}=1 and b_{i}b_{j}=0 for i\neq j , there is f\in T(n) such that f[i]=b_{i} for all 1\leq i\leq n . Proof. Regarding the first item, the fact that f[i]f[j]=0 for each i\neq j follows applying idempotence and ( 2.6 ) of Lemma 2.9 ; that f[1]\lor\cdots\lor f[n]=1 follows from associating the disjunction to the right and repeatedly applying ( 2.6 ). The second item is [ 10 , Lemma 4.6(i)] . Finally, we prove the third item. The proof is by induction on n (cf. the proof of [ 10 , Proposition 4.7] ). If n=1 , then f(x)=x . Assume that the result holds for n-1 , and let (b_{1},\ldots,b_{n}) be such that b_{1}\lor\cdots\lor b_{n}=1 and b_{i}\land b_{j}=0 for i\neq j . By inductive assumption there is g\in T(n-1) such that g[1]=b_{1}\lor b_{2} and g[i]=b_{i+1} for 2\leq i\leq n . Let f(x_{1},\ldots,x_{n}):=b_{1}(x_{1},g(x_{2},\ldots,x_{n})) . We prove that f[i]=b_{i} ; we separate the case i=1 , which does not depend on the inductive assumption, \displaystyle f[1](x,y) \displaystyle=b_{1}(x,g(y,\ldots,y)) \displaystyle=b_{1}(x,y) \displaystyle g\text{ is idempotent} from the case i\neq 1 : \displaystyle f[i](x,y) \displaystyle=b_{1}(y,g[i-1](x,y)) \displaystyle=\lnot b_{1}(g[i-1](x,y),y) \displaystyle=(\lnot b_{1}\land g[i-1])(x,y) \displaystyle=(\lnot b_{1}\land b_{i})(x,y) by inductive assumption for all 2\leq i\leq n , but \lnot b_{1}\land b_{i}=b_{i} as b_{1}\lor\cdots\lor b_{n}=1 and b_{i}\land b_{j}=0 for i\neq j . This concludes the proof. ∎ This leads us to a new proof of one of the results of [ 10 , Theorem 4.9] . Lemma 3.6 . Let B be a Boolean ring. The ring H_{B}(2) of Lemma 3.3 is isomorphic to B . Proof. Recall that H_{B}(n)=\{(b_{1},\ldots,b_{n})\in B^{n}:b_{1}\lor\cdots\lor b_{n}=1\text{ and }b_{i}\land b_{j}=0\text{ for }i\neq j\} . In particular H_{B}(2)=\{(b,\lnot b):b\in B\} . Then, by definition: \displaystyle(a,1-a)\lor(b,1-b) \displaystyle=\begin{bmatrix}1&b\\ 0&1-b\end{bmatrix}\begin{bmatrix}a\\ 1-a\end{bmatrix}=(a\lor b,1-(a\lor b)) \displaystyle(a,1-b)\land(b,1-b) \displaystyle=\begin{bmatrix}b&0\\ 1-b&1\end{bmatrix}\begin{bmatrix}a\\ 1-a\end{bmatrix}=(a\land b,1-(a\land b)) \displaystyle\lnot(b,1-b) \displaystyle=\begin{bmatrix}0&1\\ 1&0\end{bmatrix}\begin{bmatrix}b\\ 1-b\end{bmatrix}=(\lnot b,b) This concludes the proof. ∎ Theorem 3.7 . The full subcategory of hyperaffine theories different from U^{\prime} is equivalent to the category of Boolean rings. Proof. Let H\neq U^{\prime} be a hyperaffine theory, and let B be a Boolean ring. The two assignments H\mapsto H(2) and B\mapsto H_{B} are functorial. By Lemma 3.6 B is isomorphic to H_{B}(2) . For each n\in\mathbb{N} , we consider \varphi:H(n)\to H(2)^{n} given by \varphi(f)=(f[1],\ldots,f[n]) . By Proposition 3.5 (1) \varphi is well-defined, and by Proposition 3.5 (2) and (3) \varphi is a bijection onto the image \{(b_{1},\ldots,b_{n})\in H(2)^{n}:b_{1}\lor\cdots\lor b_{n}=1,b_{i}b_{j}=0\} . We prove that \varphi is a morphism of theories, i.e. that for every f\in H(n) and g_{1},\ldots,g_{n}\in H(m) \varphi(f)(\varphi(g_{1}),\ldots,\varphi(g_{n}))(x_{1},\ldots,x_{m})=\varphi(f(g_{1},\ldots,g_{n}))(x_{1},\ldots,x_{m})\text{.} By definition of \varphi this amounts to prove that \begin{bmatrix}g_{1}[1]&\cdots&g_{n}[1]\\ \vdots&\ddots&\vdots\\ g_{1}[m]&\cdots&g_{n}[m]\end{bmatrix}\begin{bmatrix}f[1]\\ \vdots\\ f[n]\end{bmatrix}(x,y)=\begin{bmatrix}f(g_{1},\ldots,g_{n})[1]\\ \vdots\\ f(g_{1},\ldots,g_{n})[m]\end{bmatrix}(x,y)\text{,} i.e. that for every i=1,\ldots,m , f[1]g_{1}[i](x,y)\lor\cdots\lor f[n]g_{n}[i](x,y)=f(g_{1}[i](x,y),\ldots,g_{n}[i](x,y))\text{.} For simplicity’s sake, fix i=1 . Employing idempotence of f and ( 2.6 ) Lemma 2.9 , one can see that \displaystyle f[1]g_{1}[1](x,y)\lor f[2]g_{2}[1](x,y)=f(g_{1}[1](x,y),g_{2}[1](x,y),y,\ldots,y) and then, inductively, f[1]g_{1}[1](x,y)\lor\cdots\lor f[n]g_{n}[1](x,y)=f(g_{1}[1](x,y),\ldots,g_{n}[1](x,y))\text{.} As the calculation with i=2,\ldots,n is similar, we obtain the desired result. ∎ 3.2. Commutative rings and affine theories In the case of affine theories, the assumption that every operation is a decomposition operation (cf. Definition 2.4 ) is exchanged for the requirement of the existence of a Mal’cev operation. Note that the only model of a Mal’cev operation p that splits is degenerate: y=p(y,x,x)=p(p(x,x,y),p(x,y,y),p(x,y,y))=p(x,y,y)=x\text{,} and therefore there are only two theories that are affine and hyperaffine at the same time: the degenerate ones. Definition 3.8 . For a given commutative ring R , we define the algebraic theory A_{R} whose operations in A_{R}(n) are (r_{1},\ldots,r_{n})\in R^{n} such that r_{1}+\cdots+r_{n}=1 . Lemma 3.9 . The algebraic theory A_{R} is idempotent and commutative. Moreover, the operation (1,-1,1)\in A_{R}(3) is a Mal’cev operation. Proof. The proof is similar to that of Lemma 3.2 . The commutativity of the monoid (R,\cdot,1) ensures that A_{R} is commutative, and the condition r_{1}+\cdots+r_{n}=1 that A_{R} is idempotent. Finally, (1,-1,1) is a Mal’cev operation: \begin{bmatrix}1\\ -1\\ 1\end{bmatrix}\circ\begin{bmatrix}a_{1}&b_{1}&b_{1}\\ \vdots&\vdots&\vdots\\ a_{m}&b_{m}&b_{m}\end{bmatrix}=\begin{bmatrix}a_{1}\\ \vdots\\ a_{m}\end{bmatrix} for any (a_{1},\ldots,a_{m}),(b_{1},\ldots,b_{m})\in T(m) and similarly for the other condition. ∎ We prove the analogous of Lemma 3.3 . See [ 23 , Theorem 6.3.3] for the similar result stating that a free Mal’cev mode on two generators can be endowed with the structure of commutative ring. Lemma 3.10 . If T is affine, then T(2) is a commutative ring with the operations defined as follows, for every a(x,y),b(x,y)\in T(2) : • (a+b)(x,y):=p(a(x,y),y,b(x,y)) ; • (a\cdot b)(x,y):=a(b(x,y),y) ; • -a(x,y):=p(y,a(x,y),y) ; • 0(x,y):=y and 1(x,y):=x Proof. Associativity and commutativity of the addition follow from Lemma 2.6 (M1) and (M2). Moreover, \displaystyle(a+0)(x,y) \displaystyle=p(a(x,y),y,y) \displaystyle=a(x,y) \displaystyle p\text{ is Mal'cev} \displaystyle(a+(-a))(x,y) \displaystyle=p(a(x,y),y,p(y,a(x,y),y)) \displaystyle=p(p(a(x,y),y,y),a(x,y),y) by Lemma 2.6 (M1) \displaystyle=p(a(x,y),a(x,y),y) \displaystyle p\text{ is Mal'cev} \displaystyle=y \displaystyle p\text{ is Mal'cev} \displaystyle=0(x,y)\text{.} Associativity and unitality of the multiplication are immediate. We prove commutativity: \displaystyle(a\cdot b)(x,y) \displaystyle=a(b(x,y),y) \displaystyle=a(b(x,y),b(y,y)) \displaystyle b\text{ is idempotent} \displaystyle=b(a(x,y),a(y,y)) \displaystyle a,b\text{ commute} \displaystyle=b(a(x,y),y) \displaystyle a\text{ is idempotent} \displaystyle=(b\cdot a)(x,y)\text{.} Finally, \displaystyle r(a+b)(x,y) \displaystyle=r(p(a(x,y),y,b(x,y)),y) \displaystyle=r(p(a(x,y),y,b(x,y)),p(y,y,y)) \displaystyle p\text{ is idempotent} \displaystyle=p(r(a(x,y),y),r(y,y),r(b(x,y),y)) \displaystyle p,r\text{ commute} \displaystyle=p(r(a(x,y),y),y,r(b(x,y),y)) \displaystyle r\text{ is idempotent} \displaystyle=(ra+rb)(x,y)\text{.} This completes the proof. ∎ Lemma 3.11 . If T is an affine theory, then p(a(x,y),b(x,y),c(x,y))=(a-b+c)(x,y)\text{.} Proof. Let p be the Mal’cev operation. Then, exploiting Lemma 2.6 \displaystyle p(a(x,y),b(x,y),c(x,y)) \displaystyle=p(a(x,y),b(x,y),p(y,y,c(x,y))) \displaystyle=p(p(a(x,y),b(x,y),y),y,c(x,y)) (M1) \displaystyle=p(p(p(a(x,y),y,y),b(x,y),y),y,c(x,y)) \displaystyle=p(p(a(x,y),y,p(y,b(x,y),y)),y,c(x,y)) (M1) \displaystyle=p((a-b)(x,y),y,c(x,y)) \displaystyle=(a-b+c)(x,y) for every a,b,c\in T(2) . ∎ Lemma 3.12 . Let R be a commutative ring. The ring A_{R}(2) of Lemma 3.10 is isomorphic to R . Proof. Recall that A_{R}(n)=\{(r_{1},\ldots,r_{n})\in R^{n}:r_{1}+\cdots+r_{n}=1\} . In particular A_{R}(2)=\{(r,1-r):r\in R\} . Then, by definition: \displaystyle(r,1-r)+(s,1-s) \displaystyle=\begin{bmatrix}r&0&s\\ 1-r&1&1-s\end{bmatrix}\begin{bmatrix}1\\ -1\\ 1\end{bmatrix}=(r+s,1-r-s) \displaystyle(r,1-r)\cdot(s,1-s) \displaystyle=\begin{bmatrix}s&0\\ 1-s&1\end{bmatrix}\begin{bmatrix}r\\ 1-r\end{bmatrix}=(rs,1-rs) \displaystyle-(r,1-r) \displaystyle=\begin{bmatrix}0&r&0\\ 1&1-r&1\end{bmatrix}\begin{bmatrix}1\\ -1\\ 1\end{bmatrix}=(-r,1+r) This concludes the proof. ∎ Now, we prove the analogue of Proposition 3.5 . Proposition 3.13 . Let T be an affine theory. Let R be the commutative ring T(2) . The following hold: (1) if f\in T(n) , then f[1]+\cdots+f[n]=1 in R ; (2) for f,g\in T(n) , if f[i]=g[i] for all 1\leq i\leq n , then f=g ; (3) for every (r_{1},\ldots,r_{n})\in R^{n} such that r_{1}+\cdots+r_{n}=1 , there is f\in T(n) such that f[i]=r_{i} for all 1\leq i\leq n . Proof. Regarding the first item, we prove that f[1]+\cdots+f[n]=1 . Observe that \displaystyle(f[1]+f[2])(x,y) \displaystyle=p(f[1](x,y),y,f[2](x,y)) \displaystyle=p(f(x,y,\ldots,y),f(y,y\ldots,y),f(y,x,\ldots,y)) \displaystyle f\text{ is idemp.} \displaystyle=f(p(x,y,y),p(y,y,x),\ldots,p(y,y,y)) \displaystyle p,f\text{ commute} \displaystyle=f(x,x,y\ldots,y) \displaystyle p\text{ is Mal'cev} and, therefore, inductively, (f[1]+\cdots+f[n])(x,y)=f(x,x,\ldots,x)=x\text{.} For the second item, observe that \displaystyle p(f[1](x_{1},y),y,f[2](x_{2},y)) \displaystyle=p(f(x_{1},y,\ldots,y),f(y,y\ldots,y),f(y,x_{2},\ldots,y)) \displaystyle=f(p(x_{1},y,y),p(y,y,x_{2}),\ldots,p(y,y,y)) \displaystyle=f(x_{1},x_{2},y\ldots,y) and, therefore, inductively, p(f(x_{1},\ldots,x_{n-1},y),y,f[n](x_{n},y))=f(x_{1},x_{2},\ldots,x_{n})\text{.} This implies that if f[i]=g[i] for all i=1,\ldots,n , then f=g . Finally, we prove the third item. The proof is by induction on n . If n=1 , then clearly f(x)=x . Assume that the result holds for n-1 , and let (r_{1},\ldots,r_{n})\in R^{n} be such that r_{1}+\cdots+r_{n}=1 . By inductive assumption there is g\in T(n-1) such that g[1]=r_{1}+r_{2} and g[i]=r_{i+1} for 2\leq i\leq n . Let f(x_{1},\ldots,x_{n}):=p(r_{2}(x_{2},x_{1}),x_{1},g(x_{1},x_{3},\ldots,x_{n})) . We prove that f[i]=r_{i} ; we separate three cases i=1,2 and 3\leq i\leq n : \displaystyle f(x,y,\ldots,y) \displaystyle=p(r_{2}(y,x),x,g(x,y,\ldots,y)) \displaystyle=r_{2}(y,x)-x+g[1](x,y) by Lemma 3.11 \displaystyle=(1-r_{2}-1+r_{1}+r_{2})(x,y) by inductive assumption \displaystyle=r_{1}(x,y) \displaystyle f(y,x,y,\ldots,y) \displaystyle=p(r_{2}(x,y),y,g(y,\ldots,y)) \displaystyle=p(r_{2}(x,y),y,y) \displaystyle g\text{ is idempotent} \displaystyle=r_{2}(x,y) \displaystyle p\text{ is Mal'cev} \displaystyle f[i](x,y) \displaystyle=p(r_{2}(y,y),y,g[i-1](x,y)) \displaystyle 3\leq i\leq n \displaystyle=p(y,y,g[i-1](x,y)) \displaystyle r_{2}\text{ is idempotent} \displaystyle=g[i-1](x,y) \displaystyle p\text{ is Mal'cev} \displaystyle=r_{i}(x,y) by inductive assumption This concludes the proof. ∎ We have all the ingredients to present one of the main theorems. Theorem 3.14 . The full subcategory of affine theories different from U^{\prime} is equivalent to the category of commutative rings. Proof. Let A\neq U^{\prime} be an affine theory, and let R be a commutative ring. The two assignments A\mapsto A(2) and R\mapsto A_{R} are functorial. Lemma 3.12 says that R is isomorphic to A_{R}(2) . For each n\in\mathbb{N} , consider the function \varphi:A(n)\to A(2)^{n} such that \varphi(f)=(f[1],\ldots,f[n]) . By Proposition 3.13 , \varphi is a bijection onto the image \{(r_{1},\ldots,r_{n})\in A(2)^{n}:r_{1}+\cdots+r_{n}=1\} . We prove that \varphi is a morphism of theories, i.e. that for every f\in A(n) and g_{1},\ldots,g_{n}\in A(m) \varphi(f)(\varphi(g_{1}),\ldots,\varphi(g_{n}))(x_{1},\ldots,x_{m})=\varphi(f(g_{1},\ldots,g_{n}))(x_{1},\ldots,x_{m})\text{.} By definition of \varphi this amounts to prove that \begin{bmatrix}g_{1}[1]&\cdots&g_{n}[1]\\ \vdots&\ddots&\vdots\\ g_{1}[m]&\cdots&g_{n}[m]\end{bmatrix}\begin{bmatrix}f[1]\\ \vdots\\ f[n]\end{bmatrix}(x,y)=\begin{bmatrix}f(g_{1},\ldots,g_{n})[1]\\ \vdots\\ f(g_{1},\ldots,g_{n})[m]\end{bmatrix}(x,y)\text{,} i.e. that for every i=1,\ldots,m , f[1]g_{1}[i](x,y)+\cdots+f[n]g_{n}[i](x,y)=f(g_{1}[i](x,y),\ldots,g_{n}[i](x,y))\text{.} For simplicity’s sake, fix i=1 . Observe that \displaystyle f[1]g_{1}[1](x,y)+f[2]g_{2}[1](x,y) \displaystyle=p(f[1](g_{1}[1](x,y),y),y,f[2](g_{2}[1](x,y),y)) \displaystyle=p(f[1](g_{1}[1](x,y),y),f(y,\ldots,y),f[2](g_{2}[1](x,y),y)) \displaystyle=f(p(g_{1}[1](x,y),y,y),p(y,y,g_{2}[1](x,y)),y,\ldots,y) \displaystyle=f(g_{1}[1](x,y),g_{2}[1](x,y),y,\ldots,y) and inductively, f[1]g_{1}[1](x,y)+\cdots+f[n]g_{n}[1](x,y)=f(g_{1}[1](x,y),\ldots,g_{n}[1](x,y)) as desired. As the calculation with i=2,\ldots,n is similar, we obtain the desired result. ∎ 4. Hyperaffine theories and algebraic logic. In [ 9 ] it is shown that the variety of Boolean algebras can be axiomatised using two nullary operations, 0 and 1 , and a ternary operation q called ‘conditional disjunction’. Expressed in terms of the Boolean operators, conditional disjunction is q(a,x,y)=(a\land x)\lor(\lnot a\land y) . The restriction of the conditions of Definition 2.7 defining hyperaffine theories to binary operations yields the following axiomatisation of Boolean algebras: • q(a,1,0)=a ; • q(1,a,b)=a and q(0,a,b)=b ; • q(a,q(b,x,y),q(c,x,y))=q(q(a,b,c),x,y) ; • q(a,x,x)=x ; • q(a,q(b,x,y),q(b,z,w))=q(b,q(a,x,z),q(a,y,w)) ; • q(a,q(a,x,y),q(a,z,w))=q(a,x,w) . In [ 7 , 24 , 6 ] these axioms have been adapted from dimension 2 to dimension n , with n constants e_{1},\ldots,e_{n} acting as projections and a generalised (n+1) -ary if-then-else q . Definition 4.1 . [ 7 , Definition 3.7] A Boolean algebra of dimension n ( n BA) is a set A endowed with nullary operations e_{1},\ldots,e_{n} and a (n+1) -ary operation q:A^{n+1}\to A satisfying the following identities: H1: q(e_{i},x_{1},\ldots,x_{n})=x_{i} for every i=1,\ldots,n ; H2: q(y,x,\ldots,x)=x ; H3: q(y,q(y,x^{1}_{1},x^{1}_{2},...,x^{1}_{n}),\ldots,q(y,x^{n}_{1},x^{n}_{2},\ldots,x^{n}_{n}))=q(y,x^{1}_{1},\ldots,x^{n}_{n}) ; H4: q(y,q(z_{1},x^{1}_{1},\ldots,x^{1}_{n}),\ldots,q(z_{n},x^{n}_{1},\ldots,x^{n}_{n}))\\ =q(q(y,z_{1},\ldots,z_{n}),q(y,x^{1}_{1},\ldots,x^{n}_{1}),\ldots,q(y,x^{1}_{n},\ldots,x^{n}_{n})) ; H5: q(y,e_{1},...,e_{n})=y . If A is an n BA, let t(a,a_{1},a_{2}):=q(a,a_{1},a_{2},e_{3},\ldots,e_{n}) for every a,a_{1},a_{2}\in A . The set B_{A}:=\{a\in A:t(a,b,b)=b\} is a Boolean algebra with respect to the ternary operation t and constants e_{1},e_{2} ; see [ 6 , Lemma 4] and subsequent discussion. The Boolean algebra B_{A} is called the Boolean algebra of the coordinates of A . The coordinates of an element a\in A are the elements of B_{A} defined as a[1]=q(a,e_{1},e_{2},\ldots,e_{2}),\ldots,a[n]=q(a,e_{2},\ldots,e_{2},e_{1})\text{.} See [ 6 , Definition 10, Lemma 6] . This is similar to the Definition 3.4 of coefficients given above. The connection with hyperaffine theories is the following. Theorem 4.2 . If T is a hyperaffine theory, then T(n) is an n BA by letting e_{i}:=\pi^{n}_{i} for i=1,\ldots,n and by defining q:T(n)^{n+1}\to T(n)\quad\text{ as }\quad\circ:T(n)\times T(n)^{n}\to T(n)\text{.} Conversely, for any sequence (A_{n},q_{n},e^{n}_{1},\ldots,e^{n}_{n})_{n\geq 2} of n BAs such that B_{A_{n}}=B_{A_{m}} for every n,m there is, up to isomorphism of theories, a unique hyperaffine theory T such that T(n)=A_{n} , q_{n}(a,b^{1},\ldots,b^{n})=a\circ(b^{1},\ldots,b^{n})\quad\text{ and }\quad e^{n}_{i}=\pi^{n}_{i} for every a,b^{1},\ldots,b^{n}\in A_{n} and every i=1,\ldots,n . Proof. Let T be hyperaffine and let n\geq 1 . Then T(n) satisfies (H1) by the definition of algebraic theory, more precisely condition ( 2.1 ). Identity (H2) follows from the fact that T is idempotent, and (H3) because every operation splits. Finally, T(n) satisfies (H4) by Lemma 2.9 and (H5) again by ( 2.1 ). Conversely, let (A_{n})_{n\geq 2} be a sequence of n BAs having the same Boolean algebra B of the coordinates. To avoid trivialities, we assume that B is nondegenerate. Then we let T to be the hyperaffine theory H_{B} . Consider the function \psi:A_{n}\to H_{B}(n) mapping an element a to its coordinates \psi(a)=(a[1],\ldots,a[n]) . By [ 6 , Lemma 8 (i)] \psi is well-defined. Moreover, it is injective by [ 6 , Lemma 9] and a surjective homomorphism by [ 6 , Theorem 8] . The fact that \pi^{n}_{i}=e^{n}_{i} for every i=1,\ldots,n is immediate and that q_{n}(a,b^{1},\ldots,b^{n})=a\circ(b^{1},\ldots,b^{n}) for every a,b^{1},\ldots,b^{n}\in A_{n} follows from [ 6 , Lemma 8(ii)] . ∎ On the one hand, n BAs have inspired work aimed at generalising the proof theory of classical propositional logic to the case of an arbitrary finite number of symmetric truth values [ 5 ] . On the other, they have been discovered to have a connection with the skew Boolean algebras introduced by Leech [ 16 , 17 , 18 ] . More precisely, it was shown in [ 7 ] that any n BA A contains a skew cluster of isomorphic right-handed skew Boolean algebras, called its skew reducts ; moreover, the skew reducts of A allow to recover A perfectly. By exploiting the correspondence between affine theories and commutative rings from Theorem 3.14 , we aim to define an n -dimensional commutative ring via axioms similar to (H1)-(H5). It is reasonable to expect that this approach may yield a definition of a skew ring and a result similar to the one established in [ 7 ] and mentioned previously. We defer this investigation to future research. 5. Boolean actions Given a Boolean ring B , there are two ways to encode B as an algebraic theory: either as the hyperaffine theory H_{B} or as the affine theory A_{B} . Models of H_{B} are the well-known B -sets [ 2 ] . It is therefore of interest to investigate models of an affine theory when the coefficient ring is Boolean, a task we undertake in this section. We observe that the models of H_{B} highlight the set-theoretic properties of B , whereas the models of A_{B} emphasise its algebraic structure (cf. Theorem 5.7 and the role of Boolean vector spaces). We begin with the following observation. Lemma 5.1 . Let B be a Boolean ring. If X is a model of A_{B} or a model of H_{B} , then X is endowed with a binary action of B , i.e. a function B\times X^{2}\to X , satisfying the following axioms: R1: b(x,x)=x ; R2: b(c(x,y),c(z,w))=c(b(x,z),b(y,w)) ; R3: 1(x,y)=x and 0(x,y)=y ; R4: a(b(x,y),c(x,y))=(ab+(1-a)c)(x,y) for all x,y,z,w\in X and a,b,c\in R . Proof. By Lemma 3.12 and Lemma 3.6 , A_{B}(2) and H_{B}(2) are Boolean rings isomorphic to B . Note that (R1) follows from the idempotence of A_{B} (or H_{B} ), (R2) from the commutativity, while (R3) and (R4) from the fact that X is a model (cf. conditions ( 2.4 ) and ( 2.5 ) of Section 2). ∎ A set of axioms similar to (R1)-(R4) was given by Bergman with the purpose of capturing the concept of action of B on a set. Definition 5.2 . [ 2 , Definition 7] Let B be a Boolean ring. A B -set is a set X together with a function b:X^{2}\to X for each b\in B satisfying the following requirements: B1: b(x,x)=x ; B2: b(b(x,y),z)=b(x,z)=b(x,b(y,z)) ; B3: (1-b)(x,y)=b(y,x) ; B4: 0(x,y)=y ; B5: b(c(x,y),y)=(bc)(x,y) for all x,y\in X and b,c\in B . Remark 5.3 . More generally, an action of B on an algebra is an action on the underlying set of the algebra, such that each operation b\in B commutes with each operation of the algebra. We establish that (B1)-(B5) can be rewritten as (R1)-(R4) plus an additional axiom. Lemma 5.4 . For a Boolean ring B , (B1)-(B5) are equivalent to (R1)-(R4) plus R5: b(b(x,y),b(z,w))=b(x,w) for all x,y,z,w\in X and b\in B . Proof. Assume (R1)-(R5). (R5) combined with (R1) immediately gives (B2). (R4) and (R3) give (B3). (B5) follows from (R4) with c=0 . Conversely, assume (B1)-(B5). The content of [ 2 , Proposition 11] is precisely that (B1)-(B5) imply (R2). (R3) is obvious in light of (B3) and (B4). It is not difficult to see that (R5) follows repeatedly applying (B2). To obtain (R4), first observe that ab+(1-a)c=ab\lor(1-a)c as ab(1-a)c=0 . Moreover, it easy to see that (5.1) (a\lor b)(x,y)=a(x,b(x,y))\text{.} Therefore \displaystyle(ab\lor(1-a)c)(x,y) \displaystyle=a(b(x,a(y,c(x,y))),a(y,c(x,y))) \displaystyle\eqref{eq:or},\text{(B3), (B5)} \displaystyle=a(a(b(x,y),b(x,c(x,y))),a(y,c(x,y))) (R2) \displaystyle=a(b(x,y),c(x,y)) (R5) This concludes the proof. ∎ Algebras for a hyperaffine theory T are exactly sets equipped with the Boolean action of T(2) . Corollary 5.5 . Let T be a hyperaffine theory, and let B:=T(2) be the Boolean ring associated with T . Then the models of T are sets equipped with an action of B satisfying (R1)-(R5) . Proof. By [ 10 , Proposition 3.16] , and by Lemma 5.4 . ∎ Unlike the case of hyperaffine theories, binary operations do not completely determine an affine theory, due to the presence of the ternary Mal’cev operation p . However, axioms (R1)-(R4) can describe models of an affine theory if the Mal’cev operation can be expressed as composition of binary operations, and this holds iff there are no ring homomorphisms from R to \mathbb{F}_{2} , where \mathbb{F}_{2} is the field with two elements (see e.g. [ 29 , 12 ] ). In this case, models of an affine theory T are sets with a binary action of the ring R:=T(2) satisfying (R1)-(R4). Axioms in the general case can be deduced as follows. Proposition 5.6 . For an affine theory T , and associated ring R:=T(2) , models of T are sets equipped with binary operations a:X^{2}\to X for each a\in R satisfying (R1)-(R4) and a ternary operation p:X^{3}\to X satisfying A1: p is a Mal’cev operation; A2: p commutes with itself and with every a\in R ; A3: p(y,x,y)=(1+1)(y,x) ; A4: p(a(x,y),b(x,y),c(x,y))=(a-b+c)(x,y) . Proof. A model of T is an affine R -module, that is a R -module whose linear combinations r_{1}x_{1}+\cdots+r_{n}x_{n} satisfy r_{1}+\cdots+r_{n}=1 . Then the result follows from [ 23 , Theorem 6.3.4] . ∎ When B is a Boolean ring, we obtain the following characterisation. Theorem 5.7 . Let B be a Boolean ring, and consider the affine theory A_{B} . Models of A_{B} , together with the choice of an element o\in X , are precisely vector spaces over \mathbb{F}_{2} equipped with an action of B satisfying (R1)-(R4) and such that L1: b(x,y)+b(z,w)=b(x+z,y+w) for every a,b\in B and x,y,z,w\in X . Proof. If X models A_{B} , then X is endowed with an action of B and has a ternary operation satisfying (R1)-(R4) and (A1)-(A4). We endow X with the structure of \mathbb{F}_{2} -vector space as follows. We define x+y:=p(x,o,y) ; this sum is associative and commutative by (A1), (A2) and Lemma 2.6 . The element o\in X is a zero for the sum by (A1). Moreover, the inverse of x is given by x itself as (A3) shows: x+x=p(x,o,x)=0(x,o)=o\text{.} Then, we add the action of \mathbb{F}_{2} : 1x:=x , 0x:=o . The only nontrivial axiom is proven using (A3): (1+1)x=0x=o=0(x,o)=(1+1)(x,o)=p(x,o,x)=x+x=1x+1x\text{.} Finally, using (A2) it is easy to derive (L1). Conversely, given an \mathbb{F}_{2} -vector space (X,+,0) with an action of B that satisfies (R1)-(R4) and (L1), we define p(x,y,z)=x+y+z . As X has characteristic 2 , (A1) is verified. (A3) follows by definition of p : p(y,x,y)=y+x+y=(1+1)y+x=x=0(y,x)=(1+1)(y,x)\text{.} Moreover, (A2) follows from (L1). Now, observe that \displaystyle(a+b)(x,y) \displaystyle=a(b(y,x),b(x,y)) (R4),(B3) \displaystyle=a(b(x,y)+b(y,x)+b(x,y),0+b(x,y)) \displaystyle=a(b(x,y)+b(y,x),0)+b(x,y) (L1),(R1) \displaystyle=a(b(x+y,y+x),0)+b(x,y) (L1) \displaystyle=a(b(x+y,x+y),0)+b(x,y) \displaystyle=a(x+y,0)+b(x,y) (L1),(R1) \displaystyle=a(x+y,y+y)+b(x,y) \displaystyle=a(x,y)+y+b(x,y) (L1),(R1) and therefore \displaystyle(a+b+c)(x,y) \displaystyle=a(b(c(x,y),c(y,x)),b(c(y,x),c(x,y))) (R4) \displaystyle=a(b(y,x)+x+c(y,x),b(x,y)+y+c(x,y)) \displaystyle=a(b(y,x),b(x,y))+a(x,y)+a(c(y,x),c(x,y)) (L1) \displaystyle=a(x,y)+y+b(x,y)+a(x,y)+a(x,y)+y+c(x,y) \displaystyle=a(x,y)+b(x,y)+c(x,y) proving (A4). ∎ We sum up the results of this section in Table 1 . In the table B is a Boolean ring and R is a commutative ring. Table 1. A summary of the results of this section Axioms characterise by virtue of (B1)-(B5) models of H_{B} [ 10 , Proposition 3.16] (R1)-(R5) models of H_{B} Lemma 5.4 (R1)-(R4), (A1)-(A4) models of A_{R} Proposition 5.6 (R1)-(R4) models of A_{R} with no R\to\mathbb{F}_{2} [ 29 , 12 ] (R1)-(R4), (L1) models of A_{B} Theorem 5.7 In [ 21 ] , the semantics of if-then-else is given in terms of an action of B on a \lor -semilattice with \bot , in the sense of Remark 5.3 . Theorem 5.7 suggests that it might be interesting to investigate a semantics of if-then-else as a weakened (omitting (R5)) linear action of B on an \mathbb{F}_{2} -vector space. 5.1. Boolean actions and sheaves In this section we give a sheaf representation of the structures of Theorem 5.7 . We start with some notation and preliminaries. Given a Boolean algebra B we ambiguously denote by B the category whose objects are the elements of B and there is an arrow b\to c if b\leq c . Let \mathcal{V} be a variety of algebras. A sheaf S:B^{\op}\to\mathcal{V} is a functor such that S(b)\simeq S(c)\times S(d) when b=c\lor d and cd=0 . We recall Bergman’s result concerning B -sets that will be used in the proof of Theorem 5.9 . Theorem 5.8 . [ 2 , Theorem 12] Let B be a Boolean ring and let \mathcal{V} be a variety of algebras. • For any set X\neq\varnothing , to equip X with the structure of B -set amounts to give a sheaf S:B^{\op}\to\mathbf{Set} such that X\simeq S(1) . • For any \varnothing\neq X\in\mathcal{V} , to equip X with an action of B amounts to give a sheaf S:B^{\op}\to\mathcal{V} such that X\simeq S(1) . Thanks to Theorem 5.7 we obtain the main result of this section, which is a representation for models of an affine theory whose ring of coefficients is Boolean. Theorem 5.9 . Let B be a Boolean ring, and let A_{B} its corresponding affine theory. Let X be a nonempty model of A_{B} together with the choice of an element o\in X . To equip X with an action of B amounts to give a sheaf S:B^{\op}\to\mathbf{Vect}_{\mathbb{F}_{2}} such that X\simeq S(1) . Proof. Firstly, observe that by Theorem 5.8 and by Remark 5.3 a sheaf S:B^{\op}\to\mathbf{Vect}_{\mathbb{F}_{2}} can be equivalently described as a \mathbb{F}_{2} -vector space X such that: • X is a B -set, i.e. there is an action of B on X satisfying (B1)-(B5); • X satisfies (L1), i.e. b(x+y,z+w)=b(x,z)+b(y,w) for every b\in B and x,y,z,w\in X . Given a model X of A_{B} together with an element o\in X , we define an \mathbb{F}_{2} -vector space as in Theorem 5.7 . Now, X has an action of B that satisfies (R1)-(R4) and (L1) by Theorem 5.7 . By Lemma 5.4 , it is enough to prove that (R5) holds. We prove, equivalently, that (B2) holds (here we prove the first part of (B2), the other part being similar). Using the usual algebraic manipulations involving the Mal’cev operation, we can see that: (5.2) b(x,y)=b(x,o)+(1-b)(y,o)\text{.} This implies that: \displaystyle b(b(x,y),z) \displaystyle=b(b(x,o)+(1-b)(y,o))+(1-b)(z,o) ( 5.2 ) \displaystyle=b(b(x,o),o)+b((1-b)(y,o),o)+(1-b)(z,o) (L1) \displaystyle=b(x,o)+0(x,o)+(1-b)(z,o) (B5) \displaystyle=b(x,z) ( 5.2 ) as desiderd. The converse is obvious in light of Theorem 5.7 . ∎ 6. Conclusions and vistas This work has shown that affine and hyperaffine algebraic theories form a natural setting for representing commutative and Boolean rings, respectively. By developing a framework that accommodates both constructions, we have clarified the features that make affine theories the counterpart of commutative rings, and hyperaffine theories the counterpart of Boolean rings. Moreover, the study of the models of both reveals a close connection with the algebraic treatment of the if-then-else construct. Several directions arise. A first step is to generalise the correspondence established here beyond rings, toward suitable classes of commutative semi rings. A second line of investigation concerns the algebras described in Theorem 5.7 , which suggest an equational foundation for an if-then-else operator in linear contexts, where the combination of programs obeys algebraic rather than set-theoretic structure. Finally, a deeper understanding of the free algebras of affine theories might lead to a notion of n -dimensional commutative ring and to an extension of the classical theory of affine combinations into higher dimensions.