# Twisted forms of commutative monoid structures on affine spaces

Andrei V. Semenov and Pavel Gvozdevsky  Andrei V. Semenov: Chebyshev
Laboratory, St. Petersburg State University, 14th Line V.O., 29B, Saint
Petersburg 199178 Russia<EMAIL_ADDRESS>Pavel Gvozdevsky:
Chebyshev Laboratory, St. Petersburg State University, 14th Line V.O., 29B,
Saint Petersburg 199178 Russia<EMAIL_ADDRESS>
###### Abstract.

In this paper, we study affine commutative algebraic monoid structures on
affine spaces over an arbitrary field of characteristic zero. We obtain full
classification of such structures on $\mathbb{A}_{K}^{2}$ and
$\mathbb{A}_{K}^{3}$ and describe some generalizations on $\mathbb{A}_{K}^{n}$
for any dimension $n$.

###### Key words and phrases:

Algebraic monoids, Affine spaces, Galois descent, Non-closed fields, Schemes

Both authors are supported by ‘‘Native Towns’’, a social investment program of
PJSC ‘‘Gazprom Neft’’. Also the first author is supported in part by The Euler
International Mathematical Institute, grant number is 075-15-2019-16-20. The
first author is a winner of Young Russian Mathematics award and he is grateful
to its jury and sponsors.

##  1\. Introduction

In this paper, we study affine algebraic commutative monoids over an arbitrary
field $K$ of characteristic zero. An affine algebraic monoid is an irreducible
variety $M$ together with an assosiative multiplication map $\cdot:M\times
M\longrightarrow M$, where map $\cdot$ is a morphism of algebraic varieties,
and unit $e\in M(K)$ such that $em=me=m$ for all $m\in M$. A monoid $M$ is
called commutative, if, in addition, $ab=ba$ for all $a,b\in M$. This article
stands as a generalization of the paper [1], where affine algebraic
commutative monoids were studied over algebraically closed field $L$ of
characteristic zero, and classification of such monoids on
$\mathbb{A}_{L}^{2}$ and $\mathbb{A}_{L}^{3}$ was reached. Our goal is to
obtain such classification over an arbitrary field $K$ of characteristic zero,
not necessary algebraically closed.

It will be explained in Section 2.4 that all the monoids studied here are the
twisted forms of monoids defined in [1], i.e. they are obtained by Galois
descent. Basic facts about technique of Galois descent will be recalled in
Section 2.3. Our main results, Theorem 4.1 and Theorem 5.3, claims that in
dimensions 2 and 3 all nontrivial twisted forms can be described in terms of
formulae that define multiplication and norm in separable algebras over the
base field.

Nowadays the theory of affine algebraic monoids and group embeddings is a
deeply developed area of mathematics lying at the intersection of algebra,
algebraic geometry, combinatorics and representation theory. For further
information and general presentations see [7, 8, 10, 13]. Also let us note
that same results on algebraic monoids over affine surfaces were obtained in
[2] and [3].

In Section 2 we recall some basic facts about schemes and algebraic monoids
and develop our technique, including Galois descent and the first cohomology
set of Galois group with coefficients in the authomorphisms groups of monoids.

In Section 3 we obtain classification of commutative algebraic monoids on
$\mathbb{A}_{K}^{n}$ of rank $0$, $n$ or $n-1$ (the notion of rank is
introduced in Definition 2.3) for arbitrary field $K$ of characteristic zero.

In Sections 4 and 5 we reach a classification of all the monoid structures on
$\mathbb{A}_{K}^{2}$ and $\mathbb{A}_{K}^{3}$ correspondently.

In the last section we formulate possible questions about further
generalizations and applications of our technique.

Authors are grateful to professor Ivan Arzhantsev for helpful advises and
productive discussions.

##  2\. Main definitions and facts

Consider a field $K$ of characteristic zero and its algebraic closure
$\overline{K}$. By $\mathrm{Gal}_{\overline{K}/K}$ we denote the Galois group
of this extension.

###  2.1. Schemes as functors

Throughout the paper we deal with schemes over $K$. A $K$-scheme $X$ is
uniquely defined by its functor of points. This is a functor from the category
of $K$-algebras to the category of sets, given by

$B\mapsto\mathrm{Hom}_{\mathrm{Sch}_{K}}(\mathrm{Spec}(B),X).$

There is an explicit description of functors that occurs this way, see [4,
Chapter VI]. Thus we may identify these two notions. So if we want to define
certain scheme, we just need to define the corresponding functor. In this
approach, morphisms of schemes are the natural transformations of the
corresponding functors. Affine schemes correspond to representable functors.

If $L/K$ is a field extension, then any $L$-scheme $X$ can be viewed as a
$K$-scheme via functor $X_{K}(-)$ from category of $K$-algebras to the
category of sets, where $X_{K}(B)$ consists of pairs $(q,x)$, such that
$q\colon L\to B$ defines a structure of $L$-algebra on $B$, and $x\in X(B)$,
where $B$ is viewed as an algebra over $L$ via $q$.

By variety over $K$ we mean a reduced, separated $K$-scheme of finite type.

###  2.2. Algebraic monoids

######  Definition 2.1.

An (affine) algebraic monoid over $K$ is an irreducible (affine) algebraic
variety $M$ over $K$ with an associative multiplication $\cdot:M\times
M\longrightarrow M$, which is a morphism of algebraic varieties, and an
element $e\in M(K)$ which is a unit with respect to this multiplication.

If $M$ is isomorphic to an affine space $\mathbb{A}_{K}^{n}$ as a variety, we
call it a monoid structure on $\mathbb{A}_{K}^{n}$.

######  Lemma 2.2.

Let $M$ be a commutative algebraic monoid over $K$, whose underlying variety
is geometrically irreducible (i.e. remains irreducible after the base change
$K\to\overline{K}$). Then the functor $G$ from the category of $K$-algebras to
the category of sets, given by

$G(B)=\\{\text{invertible elements of }M(B)\\},$

is an open subscheme of $M$.

###### Proof.

This functor is naturally isomorphic to the functor

$G^{\prime}(B)=\\{(x,y)\in(M\times M)(B)\colon xy=e\\},$

which is a fiber of a multiplication morphism $\cdot\colon M\times M\to M$.
Therefore, $G$ is a scheme over $K$, and the embedding $i\colon G\to M$ is a
morphism of schemes.

It follows from the paper [9] that $i$ becomes an open immersion after the
base change $K\to\overline{K}$, and it is known that if a morphism of schemes
becomes an open immersion after the extension of the base field, then it is an
open immersion. The last fact is a special case of [12, Lemma 35.20.16]. ∎

It is clear that $G(-)$ is a group scheme.

######  Definition 2.3.

For a commutative monoid $M$ let us define the rank of $M$ (notation:
$\mathrm{rank}(M)$) as the dimension of the maximal torus of the group of its
invertible elements. Also by $\mathrm{corank}(M)$ we will denote the
codimension of the maximal torus of the group of its invertible elements.

It is easy to see that the group $G(M)$ of the invertible elements of $M$ is
isomorphic to $\mathbb{G}_{m}^{r}\times\mathbb{G}_{a}^{s}$ under the field
extension $\overline{K}$ (the proof of this well-known fact one may see in
Chapter 2 of [5], for example), since $M$ is commutative (and so $G(M)$ is
commutative too). Here $r=\mathrm{rank}(M)$ and $s=\mathrm{corank}(M)$, and we
often will simply write $r$ and $s$ instead of $\mathrm{rank}(M)$ and
$\mathrm{corank}(M)$.

###  2.3. Galois descent

Let $L/K$ be a finite Galois extension of fields with Galois group $\Gamma$.

######  Definition 2.4.

Let $Y$ be a scheme over $L$ on which $\Gamma$ acts by $K$-scheme
automorphisms. Such action is called compatible if for any $\sigma\in\Gamma$
the diagram

$\textstyle{Y\ignorespaces\ignorespaces\ignorespaces\ignorespaces\ignorespaces\ignorespaces\ignorespaces\ignorespaces}$$\scriptstyle{\sigma}$$\textstyle{Y\ignorespaces\ignorespaces\ignorespaces\ignorespaces}$$\textstyle{\mathrm{Spec}(L)\ignorespaces\ignorespaces\ignorespaces\ignorespaces}$$\scriptstyle{\sigma}$$\textstyle{\mathrm{Spec}(L)}$

commutes.

Сonsider the functor

$\displaystyle F:\\{\text{quasiproj. }K\text{-schemes}\\}$
$\displaystyle\longrightarrow\\{\text{quasiproj. }L\text{-schemes with
compatible action of }\Gamma\\}$ $\displaystyle X$ $\displaystyle\mapsto
X\otimes_{K}L,$

where $X\otimes L$ is the $L$-scheme defined by

$X\otimes L(B)=X(B).$

for any $L$-algebra $B$, and there is a Galois group action (via the canonical
action on $L$) on $X\otimes_{K}L$ viewed as a $K$-scheme. Note that as a
$K$-scheme $X\otimes L$ is just a product
$X\times_{\mathrm{Spec}(K)}\mathrm{Spec}(L)$.

######  Theorem 2.5.

(Galois descent, see [6, Section 4.4].) The functor $F$ is an equivalence of
categories.

Therefore, this functor induces an equivalence between the category of
quasiprojective algebraic monoids over $K$ and the category of quasiprojective
algebraic monoids over $L$ equipped with a compatible action of $\Gamma$
preserving monoidal structure.

Now let $M$ be an algebraic monoid over $K$. By $\mathrm{Aut}(M)$ we denote
the functor

$\displaystyle\\{\text{Field extensions }$ $\displaystyle
L/K\\}\longrightarrow\\{\text{Groups}\\}$ $\displaystyle L$
$\displaystyle\mapsto\\{\text{Automorphisms of the }L\text{-scheme
}M\otimes_{K}L\text{ preserving monoidal structure}\\}.$

The action of $\Gamma$ on $L$ induces an action on $\mathrm{Aut}(M)(L)$ by
functoriality.

######  Definition 2.6.

A map $f\colon\Gamma\to\mathrm{Aut}(M)(L)$ is called a cocycle if it satisfies
$f(\tau\rho)=f(\tau)\cdot\tau f(\rho)$ for all $\rho,\tau\in\Gamma$.

######  Definition 2.7.

Cocycles $f$ and $g$ are equivalent if there exists $c\in\mathrm{Aut}(M)(L)$,
such that $g(\sigma)=cf(\sigma)[\sigma(c)]^{-1}$ for all $\sigma\in\Gamma$.
The set of equivalence classes will be denoted by
$H^{1}(\Gamma,\mathrm{Aut}(M)(L))$.

Obviously, the first cohomology is a pointed set, where the basepoint is the
class of the trivial cocycle that maps everything to identity.

######  Definition 2.8.

An algebraic monoid $M^{\prime}$ over $K$ is called a twisted $L/K$-form of
$M$ if $M\otimes_{K}L$ and $M^{\prime}\otimes_{K}L$ are isomorphic as
algebraic monoids over $L$.

It can be deduced from the facts above that there exists a bijection between
isomorphism classes of $L/K$-forms of $M$ and $H^{1}(\Gamma,\
\mathrm{Aut}(M)(L))$, such that an $L/K$-form $M^{\prime}$ with an isomorphism
$\phi\colon M\otimes L\to M^{\prime}\otimes L$ corresponds to the class of a
cocycle $f$ defined by

$f(\sigma)=\phi^{-1}\circ\sigma\circ\phi\circ\sigma^{-1},$

cf. [6, Remark 4.5.4].

We can recover $M^{\prime}$ from a cocycle $f$ as follows

$M^{\prime}(B)=\mathrm{Hom}_{\mathrm{Sch}_{K}}(\mathrm{Spec}(B),M^{\prime})=\\{x\in\mathrm{Hom}_{\mathrm{Sch}_{L}}(\mathrm{Spec}(B\otimes
L),M^{\prime}\otimes L)\mid\forall\sigma\in\Gamma\quad
x\circ\sigma=\sigma\circ x\\}=\\\
=\\{x\in\mathrm{Hom}_{\mathrm{Sch}_{L}}(\mathrm{Spec}(B\otimes L),M\otimes
L)\mid\forall\sigma\in\Gamma\quad\phi\circ x\circ\sigma=\sigma\circ\phi\circ
x\\}=\\\ =\\{x\in\mathrm{Hom}_{\mathrm{Sch}_{L}}(\mathrm{Spec}(B\otimes
L),M\otimes L)\mid\forall\sigma\in\Gamma\quad f(\sigma)^{-1}\circ
x=\sigma\circ x\circ\sigma^{-1}\\}=\\\ =\\{x\in
M\otimes_{K}L(B\otimes_{K}L)\mid\forall\sigma\in\Gamma\quad
f(\sigma)^{-1}(x)=\sigma(x)\\},$

where $B$ is any $K$-algebra.

The proofs for algebraic groups can be found, for example, in [14]. This
principle is very general, and the case of algebraic monoids is not that
different.

######  Example 2.9.

Let $K=\mathbb{R}$, $L=\mathbb{C}$, and $M=\mathbb{G}_{m}$. In this case
$\mathrm{Aut}(M)$ equals to the constant functor $\mathbb{Z}/2\mathbb{Z}$.

Let $M^{\prime}$ be the unit circle, i.e the group scheme over $\mathbb{R}$
defined by the equation $x_{1}^{2}+x_{2}^{2}=1$, where the multiplication is
given by formulae that defines multiplication of complex numbers.

$(x_{1},x_{2})*(y_{1},y_{2})=(x_{1}y_{1}-x_{2}y_{2},x_{1}y_{2}+x_{2}y_{1}).$

There is an isomorphism

$\phi\colon M\otimes\mathbb{C}\to M^{\prime}\otimes\mathbb{C},\quad
z\mapsto(\tfrac{z+z^{-1}}{2},\tfrac{z-z^{-1}}{2i}).$

Thus $M^{\prime}$ is a twisted form of $M$. Let $f$ be the corresponding
cocycle. Let us calculate $f(\sigma)$ for
$\sigma\in\mathrm{Gal}_{\mathbb{C}/\mathbb{R}}$ be the complex conjugation.
Clearly $f(\sigma)=\phi^{-1}\circ\sigma\circ\phi\circ\sigma^{-1}$. Let $B$ be
an $\mathbb{R}$-algebra, and fix
$(q,z)\in(M\otimes\mathbb{C})_{\mathbb{R}}(B)$, i.e $q\colon\mathbb{C}\to B$
gives us a structure of $\mathbb{C}$-algebra and $z$ is an invertible element
of $B$. Denote by $\overline{q}$ the composition of $q$ with the conjugation
on $\mathbb{C}$. We have

$f(\sigma)(q,z)=(\phi^{-1}\circ\sigma\circ\phi\circ\sigma^{-1})(q,z)=(\phi^{-1}\circ\sigma\circ\phi)(\overline{q},z)=(\phi^{-1}\circ\sigma)(\overline{q},(\tfrac{z+z^{-1}}{2},\tfrac{z-z^{-1}}{2\overline{q}(i)}))=\\\
=(\phi^{-1}\circ\sigma)(\overline{q},(\tfrac{z+z^{-1}}{2},\tfrac{z^{-1}-z}{2q(i)}))=\phi^{-1}(q,(\tfrac{z+z^{-1}}{2},\tfrac{z^{-1}-z}{2q(i)}))=(q,z^{-1}).$

We see that $f(\sigma)$ does not change the $\mathbb{C}$-algebra structure, so
it is an isomorphism of $M\otimes\mathbb{C}$ as a $\mathbb{C}$-scheme, and
there is only one such nontrivial isomorphism: $z\mapsto z^{-1}$.

Now let us show how the inverse process works. Suppose that we have a cocycle
$f$ that takes complex conjugation to the non-trivial automorphism of
$M\otimes\mathbb{C}$, and we want to recover the corresponding twisted form
$M^{\prime}$. We must use formula

$M^{\prime}(B)=\\{x\in
M\otimes_{K}L(B\otimes_{K}L)\mid\forall\sigma\in\Gamma\quad
f(\sigma)^{-1}(x)=\sigma(x)\\}.$

For any $\mathbb{R}$-algebra $B$ we have

$M\otimes\mathbb{C}(B\otimes\mathbb{C})=\\{(x,y)\in(B\otimes\mathbb{C})^{2}\mid
xy=1\\}\simeq$ $\simeq\\{(x_{1},x_{2},y_{1}.y_{2})\in
B^{4}\mid(x_{1}+ix_{2})(y_{1}+iy_{2})=1\\}=$ $=\\{(x_{1},x_{2},y_{1}.y_{2})\in
B^{4}\mid x_{1}y_{1}-x_{2}y_{2}=1,\;x_{1}y_{2}+x_{2}y_{1}=0\\}.$

In these terms complex conjugation acts by the rule
$(x_{1},x_{2},y_{1},y_{2})\mapsto(x_{1},-x_{2},y_{1},-y_{2})$ and the non-
trivial automorphism of $\mathbb{G}_{m}$ acts by the rule
$(x_{1},x_{2},y_{1},y_{2})\mapsto(y_{1},y_{2},x_{1},x_{2})$. Thus we have

$M^{\prime}(B)=\\{(x_{1},x_{2},y_{1}.y_{2})\in B^{4}\mid
x_{1}y_{1}-x_{2}y_{2}=1,\;x_{1}y_{2}+x_{2}y_{1}=0,\;x_{1}=y_{1},\;x_{2}=-y_{2}\\}\simeq\\\
\simeq\\{(x_{1},x_{2})\in B^{2}\mid x_{1}^{2}+x_{2}^{2}=1\\}.$

So $M^{\prime}$ is the unit circle and the multiplication is given by formulae
that defines multiplication of complex numbers.

Therefore, the isomorphism classes of all twisted forms of $M$ (union by all
finite Galois extensions $L/K$) are classified by the set

$H^{1}(\mathrm{Gal}_{\overline{K}/K},\mathrm{Aut}(M))\overset{\mathrm{def}}{=}\varinjlim
H^{1}(\mathrm{Gal}_{L/K},\mathrm{Aut}(M)(L)),$

where the limit is taken over all finite Galois extensions $K\leq
L\leq\overline{K}$.

The following important statement will be referred as Hilbert’s Theorem 90

######  Theorem 2.10.

(Hilbert’s 90) The sets $H^{1}(\mathrm{Gal}_{\overline{K}/K},\mathbb{G}_{a})$
and $H^{1}(\mathrm{Gal}_{\overline{K}/K},\mathrm{GL}(n,-))$ are trivial for
$n\geq 1$, i.e. they contain only the basepoint.

The proofs can be found, for example, in [11].

###  2.4. Strategy of classification

The paper [1] classifies certain special cases of commutative monoid
structures on affine spaces over a closed field. We intend to extend these
results to an arbitrary field of characteristic zero. Note that all monoids
described in [1] are defined by formulae with integer coefficients. Therefore,
we can consider monoids defined by the same formulae over our field $K$. Let
us called such monoids split.

Hence over $K$ all the monoids in question are the twisted forms of the split
ones. We will classify them using Galois cohomology. Thus we need to study
automorphisms of the split monoids.

######  Remark.

It is not obvious that all of those twisted forms are isomorphic to an affine
space as a varieties, but that will follow a posteriori from our
classification.

###  2.5. Automorphisms of algebraic monoids

######  Lemma 2.11.

Let $M$ be a geometrically irreducible commutative algebraic monoid over $K$,
and $G$ be its group of invertible elements. Then

  1. (1)

Any $g\in\mathrm{Aut}(G)(L)$ induces a birational automorphism of
$M\otimes_{K}L$ (as a scheme) for any extension $L$ of $K$,

  2. (2)

The restriction map $\mathrm{Aut}(M)\to\mathrm{Aut}(G)$ is a monomorphism of
functors and its image in $\mathrm{Aut}(G)(L)$ consists precisely of elements
$g$ such that both maps induced by $g$ and $g^{-1}$ are birational and
regular.

###### Proof.

Follows easily from the fact that $G$ is a dense open subscheme of $M$. ∎

######  Lemma 2.12.

Over any field we have
$\mathrm{Aut}(\mathbb{G}_{m}^{n})\simeq\mathrm{GL}(n,\mathbb{Z})$.

###### Proof.

Consider an authomorphism $\alpha\in\mathrm{Aut}(\mathbb{G}_{m}^{n})$. So

$\alpha(1\dots\underset{\begin{subarray}{c}\uparrow\\\ \text{i-th
place}\end{subarray}}{x}\dots 1)=(x^{\alpha_{1i}}\ldots x^{\alpha_{ii}}\dots
x^{\alpha_{ni}})\text{ for all }1\leqslant i\leqslant n.$

Now let us construct map
$f:\mathrm{Aut}(\mathbb{G}_{m}^{n})\longrightarrow\mathrm{GL}(n,\mathbb{Z})$
by the rule $f(\alpha)=(\alpha_{i,j})_{i,j=1}^{n}$: clearly
$(\alpha_{i,j})_{i,j=1}^{n}\in\mathrm{GL}(n,\mathbb{Z})$ since $\alpha$ is
bijective. Now fix $A=(\beta_{i,j})_{i,j=1}^{n}\in\mathrm{GL}(n,\mathbb{Z})$
and construct $\beta\in\mathrm{Aut}(\mathbb{G}_{m}^{n})$ by the rule

$\beta(x_{1},\dots,x_{n})=(\prod\limits_{i}x_{i}^{\beta_{1i}},\dots,\prod\limits_{i}x_{i}^{\beta_{ni}}),$

Obviously $\beta\in\mathrm{Aut}(\mathbb{G}_{m}^{n})$, so we obtain
$g:\mathrm{GL}(n,\mathbb{Z})\longrightarrow\mathrm{Aut}(\mathbb{G}_{m}^{n})$
by putting $g(A)=\beta$. Now it remains to observe that $fg=id$, $gf=id$, and
that $f$ is a morphism of algebraic groups: all these facts could be checked
by direct computations. ∎

##  3\. Three particular cases

In this section, we consider the cases of rank 0, corank 0 and corank 1.

######  Proposition 3.1.

Any commutative monoid on $\mathbb{A}^{n}$ of rank 0 is isomorphic to
$\mathbb{G}_{a}^{n}$, i.e.

$(x_{1},\ldots,x_{n})*(y_{1},\ldots,y_{n})=(x_{1}+y_{1},\ldots,x_{n}+y_{n}).$

###### Proof.

From Proposition 1 of [1] it follows that such monoid M becomes isomorphic to
$\mathbb{G}_{a}^{n}$ after a field extension. Automorphisms group of
$\mathbb{G}_{a}^{n}$ is $\mathrm{GL}(n,-)$. By Hilbert’s Theorem 90, its first
Galois cohomology set is trivial. Therefore, $\mathbb{G}_{a}^{n}$ has no
nontrivial twisted forms. Hence any such monoid is isomorphic to
$\mathbb{G}_{a}^{n}$ already over the base field. ∎

######  Proposition 3.2.

Any commutative monoid on $\mathbb{A}^{n}$ of corank 0 is isomorphic to the
multiplicative monoid of a separable algebra over $K$ (i.e. a direct product
of field extensions). Moreover, non-isomorphic algebras give rise to non-
isomorphic monoids.

###### Proof.

It follows from [1, Proposition 1] that any such monoid becomes isomorphic to

$(x_{1},\ldots,x_{n})*(y_{1},\ldots,y_{n})=(x_{1}y_{1},\ldots,x_{n}y_{n}).$

after a field extension.

Let us denote by $M$ the monoid defined by that last formula. Its group of
invertible elements is $\mathbb{G}_{m}^{n}$. By Lemma 2.12
$\mathrm{Aut}(\mathbb{G}_{m}^{n})$ is a constant group scheme
$\mathrm{GL}(n,\mathbb{Z})$. A matrix from $\mathrm{GL}(n,\mathbb{Z})$ induces
a regular map on $M$ if and only if all its entries are non-negative (since it
should be a regular map on monoids, not groups). Therefore, by Lemma 2.11 we
obtain that the automorphisms of $M$ are matrices
$g\in\mathrm{GL}(n,\mathbb{Z})$ such that both $g$ and $g^{-1}$ have all the
entries non-negative. It is easy to see that these are precisely the
permutation matrices. Thus $\mathrm{Aut}(M)=S_{n}$ and it acts on $M$ by
permutations of coordinates.

Note that $M$ is a multiplicative monoid of the algebra $K^{n}$. Any twisted
form of $M$ is obtained by Galois descent with cocycle in
$H^{1}(\mathrm{\mathrm{Gal}_{L/K}},S_{n})$ for some finite Galois extension
$L/K$. Since any permutation of coordinates is in fact an automorphism of the
algebra $L^{n}$, this cocycle actually gives a twisted form of the algebra
$K^{n}$ and our monoid is a multiplicative monoid of this algebra.

The second statement follows from the fact that both algebras and monoids are
classified by $H^{1}(\mathrm{\mathrm{Gal}_{\overline{K}/K}},S_{n})$. ∎

######  Example 3.3.

Let $K=\mathbb{R}$ and $n=2$. Then any monoid on $\mathbb{A}^{2}_{\mathbb{R}}$
of corank 0 is isomorphic either to componentwise multiplication

$(x_{1},x_{2})*(y_{1},y_{2})=(x_{1}y_{1},x_{2}y_{2}),$

or to multiplication of complex numbers

$(x_{1},x_{2})*(y_{1},y_{2})=(x_{1}y_{1}-x_{2}y_{2},x_{1}y_{2}+x_{2}y_{1}).$

######  Example 3.4.

Let $K=\mathbb{Q}$ and $n=2$. Then any monoid on $\mathbb{A}^{2}_{\mathbb{Q}}$
of corank 0 is isomorphic either to componentwise multiplication or to
multiplication in $\mathbb{Q}(\sqrt{d})$

$(x_{1},x_{2})*(y_{1},y_{2})=(x_{1}y_{1}+dx_{2}y_{2},x_{1}y_{2}+x_{2}y_{1}),$

where $d$ is not a square. Monoids for $d_{1}$ and $d_{2}$ are isomorphic iff
the fields $\mathbb{Q}(\sqrt{d_{1}})$ and $\mathbb{Q}(\sqrt{d_{2}})$ are
isomorphic, i.e iff $d_{1}/d_{2}$ is a square.

######  Proposition 3.5.

For any commutative monoid on $\mathbb{A}^{n}$ of corank 1 there exists a
collection of separable algebras $R_{1}$,$\ldots$,$R_{k}$ of dimensions
$d_{1}$,$\ldots$, $d_{k}$ and integers $0\leq c_{1}<\ldots<c_{k}$ such that
$d_{1}+\ldots+d_{k}=n-1$ and the monoid structure is given by

(1)
$(\overline{x}_{1},\ldots,\overline{x}_{k},x)*(\overline{y}_{1},\ldots,\overline{y}_{k},y)=(\overline{x}_{1}\overline{y}_{1},\ldots,\overline{x}_{k}\overline{y}_{k},N(\overline{x}_{1})^{c_{1}}\ldots
N(\overline{x}_{k})^{c_{k}}y+\\\ +N(\overline{y}_{1})^{c_{1}}\ldots
N(\overline{y}_{k})^{c_{k}}x),$

where $\overline{x_{i}}$, $\overline{y_{i}}$ are $d_{i}$-tuples of
coordinates, $\overline{x}_{1}\overline{y}_{1}$ is calculated by formula that
defines multiplication in $R_{i}$ in some fixed basis, and
$N(\overline{x}_{i})$, $N(\overline{y}_{i})$ are calculated by formula that
computes norm in $R_{i}$. Moreover, numbers $d_{i}$, $c_{i}$ and isomorphism
classes of $R_{i}$ are defined uniquely by the isomorphism class of the
monoid.

###### Proof.

It follows from [1, Proposition 1], that after a field extension such monoid
becomes isomorphic to

$(x_{1},\ldots,x_{n})*(y_{1},\ldots,y_{n})=(x_{1}y_{1},\ldots,x_{n-1}y_{n-1},x_{1}^{b_{1}}\ldots
x_{n-1}^{b_{n-1}}y_{n}+y_{1}^{b_{1}}\ldots y_{n-1}^{b_{n-1}}x_{n})$

for some uniquely defined integers $0\leq b_{1}\leq\ldots\leq b_{n-1}$.

Let us denote by $M$ the monoid defined by the last formula. Its group of
invertible elements is $G=\mathbb{G}_{m}^{n-1}\times\mathbb{G}_{a}$. Since
there are no nontrivial homomorphisms between $\mathbb{G}_{a}$ and
$\mathbb{G}_{m}$, we have
$\mathrm{Aut}(G)=\mathrm{GL}(n-1,\mathbb{Z})\times\mathbb{G}_{m}$, where
$\mathrm{GL}(n-1,\mathbb{Z})$ is a constant group scheme.

It is easy to see that in order for the birational morphism of $M$ defined by
$g\in\mathrm{GL}({n-1},\mathbb{Z})\times\mathbb{G}_{m}$ to be regular, it is
necessary that its first component has all entries non-negative. Matrices
$g\in\mathrm{GL}(n-1,\mathbb{Z})$, such that both $g$ and $g^{-1}$ have only
non-negative entries, are permutation matrices. So by Lemma 2.11 we obtain
that the image of the restriction map $\mathrm{Aut}(M)\to\mathrm{Aut}(G)$ is
contained in $S_{n-1}\times\mathbb{G}_{m}$.

Fix $(\sigma,z)\in S_{n-1}\times\mathbb{G}_{m}$. Let us calculate the
corresponding birational map. The embedding
$i\colon\mathbb{G}_{m}^{n-1}\times\mathbb{G}_{a}\to M=\mathbb{A}^{n}$ is given
by

$i(t_{1},\ldots,t_{n-1},v)=(t_{1},\ldots,t_{n-1},t_{1}^{b_{1}}\ldots
t_{n-1}^{b_{n-1}}v).$

Thus such map is $i\circ(\sigma,z)\circ(i^{-1})$. It is easy to see that

$i^{-1}(x_{1},\ldots,x_{n-1},x_{n})=(x_{1},\ldots,x_{n-1},t_{1}^{-b_{1}}\ldots
t_{n-1}^{-b_{n-1}}x_{n}),$

so

$(\sigma,z)\cdot(x_{1},\ldots,x_{n-1}t_{1}^{-b_{1}}\ldots
t_{n-1}^{-b_{n-1}}x_{n})=(x_{\sigma^{-1}(1)},\ldots,x_{\sigma^{-1}(n-1)},zt_{1}^{-b_{1}}\ldots
t_{n-1}^{-b_{n-1}}x_{n}),$

finally

$i(x_{\sigma^{-1}(1)},\ldots,x_{\sigma^{-1}(n-1)},zt_{1}^{-b_{1}}\ldots
t_{n-1}^{-b_{n-1}}x_{n})=\left(x_{\sigma^{-1}(1)},\ldots,x_{\sigma^{-1}(n-1)},z\prod
t_{i}^{b_{\sigma^{-1}(i)}-b_{i}}x_{n}\right).$

For this map to be regular it is necessary and sufficient that
$b_{\sigma^{-1}(i)}\geq b_{i}$ for all $i$. Since the permutation has finite
order, this means that $b_{\sigma^{-1}(i)}=b_{i}$ for all $i$, or equivalently
$b_{\sigma(i)}=b_{i}$ for all $i$.

Now put

$b_{1}=\ldots=b_{d_{1}}=c_{1},\quad b_{d_{1}+1}=\ldots=b_{d_{1}+d_{2}}=c_{2},$
$\ldots$ $b_{d_{1}+\ldots+d_{k-1}+1}=\ldots=b_{d_{1}+\ldots+d_{k}}=c_{k},$

where $\sum\limits_{i=1}^{k}d_{i}=n-1$ and $c_{1}<\ldots<c_{k}$. Note that
$c_{i}$ and $d_{i}$ are defined uniquely by $b_{i}$.

Multiplication in the monoid $M$ can now be rewritten as

$(\overline{x}_{1},\ldots,\overline{x}_{k},x)*(\overline{y}_{1},\ldots,\overline{y}_{k},y)=(\overline{x}_{1}\overline{y}_{1},\ldots,\overline{x}_{k}\overline{y}_{k},N(\overline{x}_{1})^{c_{1}}\ldots
N(\overline{x}_{k})^{c_{k}}y+\\\ +N(\overline{y}_{1})^{c_{1}}\ldots
N(\overline{y}_{k})^{c_{k}}x),$

where $\overline{x_{i}}$, $\overline{y_{i}}$ are $d_{i}$-tuples of
coordinates, $\overline{x}_{1}\overline{y}_{1}$ is the componentwise
multiplication, and $N(\overline{x}_{i})$ is the product of all entries of the
$d_{i}$-th tuple $\overline{x}_{i}$.

It follows from Lemma 2.11 and facts proved above that $\mathrm{Aut}(M)=\prod
S_{d_{i}}\times\mathbb{G}_{m}$, where permutations act by permuting
coordinates inside $d_{i}$-tuples, and $\mathbb{G}_{m}$ acts by scaling the
last coordinate.

When $d_{i}$ and $c_{i}$ are fixed, the twisted forms of $M$ are classified by
the set $H^{1}(\mathrm{Gal}_{\overline{K}/K},\prod
S_{d_{i}}\times\mathbb{G}_{m})$. On the other hand, the set
$H^{1}(\mathrm{Gal}_{\overline{K}/K},\prod S_{d_{i}})$ classifies collections
of separable algebras $R_{1}$,$\ldots$,$R_{k}$ of dimensions
$d_{1}$,$\ldots$,$d_{k}$. The embedding $\prod S_{d_{i}}\hookrightarrow\prod
S_{d_{i}}\times\mathbb{G}_{m}$ induces the map

$f\colon H^{1}(\mathrm{Gal}_{\overline{K}/K},\prod S_{d_{i}})\longrightarrow
H^{1}(\mathrm{Gal}_{\overline{K}/K},\prod S_{d_{i}}\times\mathbb{G}_{m}).$

This map assigns to every collection of algebras a twisted form of $M$. It is
easy to see that this assignment is given by formula (1). It remains to notice
that $H^{1}(\mathrm{Gal}_{\overline{K}/K},\mathbb{G}_{m})$ is trivial by
Hilbert’s Theorem 90, so the map $f$ is bijective. ∎

######  Example 3.6.

Let $K=\mathbb{R}$, $n=3$, $k=1$, $d_{1}=2$, and $R_{1}=\mathbb{C}$. Then the
corresponding monoid structure on $\mathbb{A}_{\mathbb{R}}^{3}$ is given by

$(x_{1},x_{2},x_{3})*(y_{1},y_{2},y_{3})=(x_{1}y_{1}-x_{2}y_{2},x_{1}y_{2}+x_{2}y_{1},(x_{1}^{2}+x_{2}^{2})^{c}y_{3}+(y_{1}^{2}+y_{2}^{2})^{c}x_{3})$

for some $c\in\mathbb{Z}_{\geq 0}$.

######  Example 3.7.

Let $K=\mathbb{Q}$, $n=3$, $k=1$, $d_{1}=2$, and $R_{1}=\mathbb{Q}(\sqrt{d})$.
Then the corresponding monoid structure on $\mathbb{A}_{\mathbb{Q}}^{3}$ is
given by

$(x_{1},x_{2},x_{3})*(y_{1},y_{2},y_{3})=(x_{1}y_{1}+dx_{2}y_{2},x_{1}y_{2}+x_{2}y_{1},(x_{1}^{2}-dx_{2}^{2})^{c}y_{3}+(y_{1}^{2}-dy_{2}^{2})^{c}x_{3})$

for some $c\in\mathbb{Z}_{\geq 0}$.

##  4\. Main results for $\mathbb{A}_{K}^{1}$ and $\mathbb{A}_{K}^{2}$

Since all commutative monoid structures on $\mathbb{A}_{K}^{1}$ and
$\mathbb{A}_{K}^{2}$ are covered by Propositions 3.1, 3.2, and 3.5 we obtain
the following classification result.

######  Theorem 4.1.

1)Every commutative monoid on $\mathbb{A}_{K}^{1}$ is isomorphic to one of the
following monoids:

$\displaystyle A\colon\quad(x)*(y)=(x+y);$ $\displaystyle
M\colon\quad(x)*(y)=(xy).$

2)Every commutative monoid on $\mathbb{A}_{K}^{2}$ is isomorphic to one of the
following monoids:

rank | Notation | $(x_{1},x_{2})*(y_{1},y_{2})$ |
---|---|---|---
0 | $2A$ | $(x_{1}+y_{1},x_{2}+y_{2})$ |
1 | $M\underset{b}{+}A$ |  $(x_{1}y_{1},x_{1}^{b}y_{2}+y_{1}^{b}x_{2})$, | $b\in\mathbb{Z}_{\geq 0}$
2 | $M+M$ | $(x_{1}y_{1},x_{2}y_{2})$ |
2 | $M(L)$ |  Multiplicative monoid of a quadratic extension $L/K$. |

Moreover these monoids are pairwise non-isomorphic.

######  Corollary 4.2.

Assume that $K=\mathbb{R}$. Then every commutative monoid on
$\mathbb{A}_{\mathbb{R}}^{1}$ or $\mathbb{A}_{\mathbb{R}}^{2}$ is isomorphic
either to one of the monoids described in [1, Proposition 2], or to one in
Example 3.3.

######  Corollary 4.3.

Assume that $K=\mathbb{Q}$. Then every commutative monoid on
$\mathbb{A}_{\mathbb{Q}}^{1}$ or $\mathbb{A}_{\mathbb{Q}}^{2}$ is isomorphic
either to one of the monoids described in [1, Proposition 2], or to one in
Example 3.4.

##  5\. Main results for $\mathbb{A}_{K}^{3}$

Now we consider the case $n=3$.

######  Proposition 5.1.

Let $b,c\in\mathbb{Z}$, $0\leq b\leq c$. Then the commutative monoid $M$ on
$\mathbb{A}_{K}^{3}$ given by

$(x_{1},x_{2},x_{3})*(y_{1},y_{2},y_{3})=(x_{1}y_{1},x_{1}^{b}y_{2}+y_{1}^{b}x_{2},x_{1}^{c}y_{3}+y_{1}^{c}x_{3})$

has no nontrivial twisted forms.

###### Proof.

Let us compute the group $\mathrm{Aut}(M)$. The group of invertible elements
of this monoid is equal to $G=\mathbb{G}_{m}\times\mathbb{G}_{a}^{2}$. Since
there are no nontrivial homomorphisms between $\mathbb{G}_{a}$ and
$\mathbb{G}_{m}$, we have
$\mathrm{Aut}(G)=\mathbb{Z}/2\mathbb{Z}\times\mathrm{GL}(2,-)$, where
$\mathbb{Z}/2\mathbb{Z}$ is a constant group scheme.

It is easy to see that in order to obtain a regular morphism on $M$, defined
by $g\in\mathrm{Aut}(M)$, the $\mathbb{Z}/2\mathbb{Z}$-component of $g$ must
be trivial. Thus by Lemma 2.11 the image of the restriction map
$\mathrm{Aut}(M)\to\mathrm{Aut}(G)$ is contained in $\mathrm{GL}(2,-)$.

Take a matrix $\left(\begin{smallmatrix}\alpha&\beta\\\
\gamma&\delta\end{smallmatrix}\right)\in\mathrm{GL}(2,L)$ for some extension
$L/K$. Let us calculate the corresponding birational map. The embedding
$i\colon\mathbb{G}_{m}\times\mathbb{G}_{a}^{2}\to M=\mathbb{A}^{3}$ is given
by

$i(t,v_{1},v_{2})=(t,t^{b}v_{1},t^{c}v_{2}).$

Thus such map is $i\circ\left(\begin{smallmatrix}\alpha&\beta\\\
\gamma&\delta\end{smallmatrix}\right)\circ(i^{-1})$. It is easy to see that

$i^{-1}(x_{1},x_{2},x_{3})=(x_{1},x_{1}^{-b}x_{2},x_{1}^{-c}x_{3}),$

so

$\left(\begin{smallmatrix}\alpha&\beta\\\
\gamma&\delta\end{smallmatrix}\right)\cdot(x_{1},x_{1}^{-b}x_{2},x_{1}^{-c}x_{3})=(x_{1},\alpha
x_{1}^{-b}x_{2}+\beta x_{1}^{-c}x_{3},\gamma x_{1}^{-b}x_{2}+\delta
x_{1}^{-c}x_{3}),$

and

$i(x_{1},\alpha x_{1}^{-b}x_{2}+\beta x_{1}^{-c}x_{3},\gamma
x_{1}^{-b}x_{2}+\delta x_{1}^{-c}x_{3})=(x_{1},\alpha x_{2}+\beta
x_{1}^{b-c}x_{3},\gamma x_{1}^{c-b}x_{2}+\delta x_{3}).$

There are two cases.

Case $b=c$. In this case, every matrix from $\mathrm{GL}(2,L)$ induces a
regular map on $M$. Therefore, $\mathrm{Aut}(M)=\mathrm{GL}(2,-)$, and by
Hilbert’s 90 Theorem $H^{1}(\mathrm{Gal}_{\overline{K}/K},\mathrm{Aut}(M))$ is
trivial.

Case $b<c$. In this case, a matrix $\left(\begin{smallmatrix}\alpha&\beta\\\
\gamma&\delta\end{smallmatrix}\right)$ from $\mathrm{GL}(2,L)$ induces a
regular map on $M$ iff $\beta=0$. Therefore, $\mathrm{Aut}(M)$ is a group of
lower-triangular invertible 2 by 2 matrices, which is isomorphic to a semi-
direct product $\mathbb{G}_{a}\leftthreetimes\mathbb{G}_{m}^{2}$. Applying
long exact sequence of cohomology and Hilbert’s Theorem 90 we again obtain
that the set $H^{1}(\mathrm{Gal}_{\overline{K}/K},\mathrm{Aut}(M))$ is
trivial. ∎

######  Proposition 5.2.

Let $b,c\in\mathbb{Z}_{>0}$, $b\leq c$. Define $d$ and $e$ by $c=bd+e$,
$d,e\in\mathbb{Z}$, $0\leq e<b$. Denote by $Q_{b,c}$ the polynomial

$Q_{b,c}(x_{1},y_{1},x_{2},y_{2})=\frac{(x_{1}^{b}y_{2}+y_{1}^{b}x_{2})^{d+1}-(x_{1}^{b}y_{2})^{d+1}-(y_{1}^{b}x_{2})^{d+1}}{x_{1}^{b-e}y_{1}^{b-e}}.$

Then the commutative monoid $M$ on $\mathbb{A}_{K}^{3}$ given by

$(x_{1},x_{2},x_{3})*(y_{1},y_{2},y_{3})=(x_{1}y_{1},x_{1}^{b}y_{2}+y_{1}^{b}x_{2},x_{1}^{c}y_{3}+y_{1}^{c}x_{3}+Q_{b,c}(x_{1},y_{1},x_{2},y_{2}))$

has no nontrivial twisted forms.

###### Proof.

Let us compute the group $\mathrm{Aut}(M)$. As before, the group of invertible
elements is equal to $G=\mathbb{G}_{m}\times\mathbb{G}_{a}^{2}$. Then
$\mathrm{Aut}(G)=\mathbb{Z}/2\mathbb{Z}\times\mathrm{GL}(2,-)$, and it is easy
to see that the image of the restriction map
$\mathrm{Aut}(M)\to\mathrm{Aut}(G)$ is contained in $\mathrm{GL}(2,-)$.

Take a matrix $\left(\begin{smallmatrix}\alpha&\beta\\\
\gamma&\delta\end{smallmatrix}\right)\in\mathrm{GL}(2,L)$ for some extension
$L/K$. Let us calculate the corresponding birational map. The embedding
$i\colon\mathbb{G}_{m}\times\mathbb{G}_{a}^{2}\to M=\mathbb{A}^{3}$ is given
by

$i(t,v_{1},v_{2})=(t,t^{b}v_{1},t^{c}(v_{2}+v_{1}^{d+1})).$

Thus such map is $i\circ\left(\begin{smallmatrix}\alpha&\beta\\\
\gamma&\delta\end{smallmatrix}\right)\circ(i^{-1})$. It is easy to see that

$i^{-1}(x_{1},x_{2},x_{3})=(x_{1},x_{1}^{-b}x_{2},x_{1}^{-c}x_{3}-(x_{1}^{-b}x_{2})^{d+1}),$

so

$\left(\begin{smallmatrix}\alpha&\beta\\\
\gamma&\delta\end{smallmatrix}\right)\cdot(x_{1},x_{1}^{-b}x_{2},x_{1}^{-c}x_{3}-(x_{1}^{-b}x_{2})^{d+1})=\\\
=(x_{1},\alpha x_{1}^{-b}x_{2}+\beta
x_{1}^{-c}x_{3}-\beta(x_{1}^{-b}x_{2})^{d+1},\gamma x_{1}^{-b}x_{2}+\delta
x_{1}^{-c}x_{3}-\delta(x_{1}^{-b}x_{2})^{d+1}),$

finally

$i(x_{1},\alpha x_{1}^{-b}x_{2}+\beta
x_{1}^{-c}x_{3}-\beta(x_{1}^{-b}x_{2})^{d+1},\gamma x_{1}^{-b}x_{2}+\delta
x_{1}^{-c}x_{3}-\delta(x_{1}^{-b}x_{2})^{d+1})=\\\ =(x_{1},\alpha x_{2}+\beta
x_{1}^{b-c}x_{3}-\beta x_{1}^{-bd}x_{2}^{d+1},\text{something}).$

We see that for the map in question to be regular, it is necessary that
$\beta=0$, because of the summand $\beta x_{1}^{-bd}x_{2}^{d+1}$. Now we
finish our computation, assuming that $\beta=0$:

$i(x_{1},\alpha x_{1}^{-b}x_{2},\gamma x_{1}^{-b}x_{2}+\delta
x_{1}^{-c}x_{3}-\delta(x_{1}^{-b}x_{2})^{d+1})=(x_{1},\alpha x_{2},\gamma
x_{1}^{c-b}x_{2}+\gamma x_{3}+(\alpha^{d+1}-\gamma)x_{1}^{e-b}x_{2}^{d+1}).$

We now see that this map is regular iff $\gamma=\alpha^{d+1}$. Therefore,

$\mathrm{Aut}(M)(L)=\left\\{\left(\begin{smallmatrix}\alpha&0\\\
\gamma&\alpha^{d+1}\end{smallmatrix}\right)\in\mathrm{GL}(2,L)\right\\}.$

This group is isomorphic to a semi-direct product
$\mathbb{G}_{a}\leftthreetimes\mathbb{G}_{m}$. Applying long exact sequence of
cohomology, and Hilbert’s 90, we again obtain that the set
$H^{1}(\mathrm{Gal}_{\overline{K}/K},\mathrm{Aut}(M))$ is trivial. ∎

For a monoid $M$ on $\mathbb{A}_{K}^{3}$ we have $rank(M)\in\\{0,1,2,3\\}$.
The cases $r=0,3,2$ are covered by Propositions 3.1, 3.2, and 3.5
correspondingly. It remains to consider the case $r=2$.

It follows from [1, Theorem 1] that any monoid on $\mathbb{A}_{K}^{3}$ of rank
2 after a field extension becomes isomorphic either to the one considered in
Proposition 5.1 or to the one considered in Proposition 5.2. Applying these
Propositions, we obtain that such isomorphism exists already over the base
field $K$.

To sum up we obtain the following classification result.

######  Theorem 5.3.

Every commutative monoid on $\mathbb{A}_{K}^{3}$ is isomorphic to one of the
following monoids:

  rank Notation $(x_{1},x_{2},x_{3})*(y_{1},y_{2},y_{3})$
0 $3A$ $(x_{1}+y_{1},x_{2}+y_{2},x_{3}+y_{3})$ 1
$M\underset{b}{+}A\underset{c}{+}A$
$(x_{1}y_{1},x_{1}^{b}y_{2}+y_{1}^{b}x_{2},x_{1}^{c}y_{3}+y_{1}^{c}x_{3})$,
$b,c\in\mathbb{Z}_{\geq 0}$, $b\leq c$, 1
$M\underset{b}{+}A\underset{b,c}{+}A$
$(x_{1}y_{1},x_{1}^{b}y_{2}+y_{1}^{b}x_{2},x_{1}^{c}y_{3}+y_{1}^{c}x_{3}+Q_{b,c}(x_{1},y_{1},x_{2},y_{2}))$,
$b,c\in\mathbb{Z}_{>0}$, $b\leq c$, 2 $M+M\underset{b,c}{+}A$
$(x_{1}y_{1},x_{2}y_{2},x_{1}^{b}x_{2}^{c}y_{3}+y_{1}^{b}y_{2}^{c}x_{3})$,
$b,c\in\mathbb{Z}_{\geq 0}$, $b\leq c$, 2 $M^{2}(L)\underset{c}{+}A$
$((x_{1},x_{2})*_{M(L)}(y_{1},y_{2}),N_{L}(x_{1},x_{2})^{c}y_{3}+N_{L}(y_{1},y_{2})^{c}x_{3})$
$c\in\mathbb{Z}_{\geq 0}$, $\deg L/K=2$ , 3 $M+M+M$
$(x_{1}y_{1},x_{2}y_{2},x_{3}y_{3})$, 3 $M^{2}(L)+M$
$((x_{1},x_{2})*_{M(L)}(y_{1},y_{2}),x_{3}y_{3})$, 3 $M^{3}(L)$ Multiplicative
monoid of a cubic extension $L/K$.

Here the polynomial $Q_{b,c}$ is defined in Proposition 5.2. By
$(x_{1},y_{1})*_{M(L)}(x_{2},y_{2})$ we mean the formula that defines
multiplication in $L$ in some fixed basis, and by $N_{L}(x_{1},x_{2})$ we mean
the formula that defines norm in $L$ in the same basis.

Moreover these monoids are pairwise non-isomorphic.

######  Corollary 5.4.

Assume that $K=\mathbb{R}$. Then every commutative monoid on
$\mathbb{A}_{\mathbb{R}}^{3}$ is isomorphic to one of the following monoids

  rank Notation $(x_{1},x_{2},x_{3})*(y_{1},y_{2},y_{3})$
0 $3A$ $(x_{1}+y_{1},x_{2}+y_{2},x_{3}+y_{3})$ 1
$M\underset{b}{+}A\underset{c}{+}A$
$(x_{1}y_{1},x_{1}^{b}y_{2}+y_{1}^{b}x_{2},x_{1}^{c}y_{3}+y_{1}^{c}x_{3})$,
$b,c\in\mathbb{Z}_{\geq 0}$, $b\leq c$, 1
$M\underset{b}{+}A\underset{b,c}{+}A$
$(x_{1}y_{1},x_{1}^{b}y_{2}+y_{1}^{b}x_{2},x_{1}^{c}y_{3}+y_{1}^{c}x_{3}+Q_{b,c}(x_{1},y_{1},x_{2},y_{2}))$,
$b,c\in\mathbb{Z}_{>0}$, $b\leq c$, 2 $M+M\underset{b,c}{+}A$
$(x_{1}y_{1},x_{2}y_{2},x_{1}^{b}x_{2}^{c}y_{3}+y_{1}^{b}y_{2}^{c}x_{3})$,
$b,c\in\mathbb{Z}_{\geq 0}$, $b\leq c$, 2 $M^{2}(\mathbb{C})\underset{c}{+}A$
$(x_{1}y_{1}-x_{2}y_{2},x_{1}y_{2}+x_{2}y_{1},(x_{1}^{2}+x_{2}^{2})^{c}y_{3}+(y_{1}^{2}+y_{2}^{2})^{c}x_{3})$
$c\in\mathbb{Z}_{\geq 0}$, 3 $M+M+M$ $(x_{1}y_{1},x_{2}y_{2},x_{3}y_{3})$, 3
$M^{2}(\mathbb{C})+M$
$(x_{1}y_{1}-x_{2}y_{2},x_{1}y_{2}+x_{2}y_{1},x_{3}y_{3})$.

######  Corollary 5.5.

Assume that $K=\mathbb{Q}$. Then every commutative monoid on
$\mathbb{A}_{\mathbb{Q}}^{3}$ is isomorphic either to one of the following
monoids

  rank Notation
$(x_{1},x_{2},x_{3})*(y_{1},y_{2},y_{3})$ 0 $3A$
$(x_{1}+y_{1},x_{2}+y_{2},x_{3}+y_{3})$ 1 $M\underset{b}{+}A\underset{c}{+}A$
$(x_{1}y_{1},x_{1}^{b}y_{2}+y_{1}^{b}x_{2},x_{1}^{c}y_{3}+y_{1}^{c}x_{3})$,
$b,c\in\mathbb{Z}_{\geq 0}$, $b\leq c$, 1
$M\underset{b}{+}A\underset{b,c}{+}A$
$(x_{1}y_{1},x_{1}^{b}y_{2}+y_{1}^{b}x_{2},x_{1}^{c}y_{3}+y_{1}^{c}x_{3}+Q_{b,c}(x_{1},y_{1},x_{2},y_{2}))$,
$b,c\in\mathbb{Z}_{>0}$, $b\leq c$, 2 $M+M\underset{b,c}{+}A$
$(x_{1}y_{1},x_{2}y_{2},x_{1}^{b}x_{2}^{c}y_{3}+y_{1}^{b}y_{2}^{c}x_{3})$,
$b,c\in\mathbb{Z}_{\geq 0}$, $b\leq c$, 2
$M^{2}(\mathbb{Q}(\sqrt{d}))\underset{c}{+}A$
$(x_{1}y_{1}+dx_{2}y_{2},x_{1}y_{2}+x_{2}y_{1},(x_{1}^{2}-dx_{2}^{2})^{c}y_{3}+(y_{1}^{2}-dy_{2}^{2})^{c}x_{3})$
$c\in\mathbb{Z}_{\geq 0}$, $d\in\mathbb{Q}$ isn’t a square 3 $M+M+M$
$(x_{1}y_{1},x_{2}y_{2},x_{3}y_{3})$, 3 $M^{2}(\mathbb{Q}(\sqrt{d}))+M$
$(x_{1}y_{1}+dx_{2}y_{2},x_{1}y_{2}+x_{2}y_{1},x_{3}y_{3})$, $d\in\mathbb{Q}$
isn’t a square 3 $M^{3}(L)$ Multiplicative monoid of a cubic extension
$L/\mathbb{Q}$.

######  Example 5.6.

Let $K=\mathbb{Q}$, and $L=\mathbb{Q}(\sqrt[3]{2})$. Then the multiplication
in $M^{3}(L)$ is defined by

$(x_{1},x_{2},x_{3})*(y_{1},y_{2},y_{3})=(x_{1}y_{1}+2x_{2}y_{3}+2x_{3}y_{2},\
x_{1}y_{2}+x_{2}y_{1}+2x_{3}y_{3},\ x_{1}y_{3}+x_{2}y_{2}+x_{3}y_{1}).$

######  Example 5.7.

Let $K=\mathbb{Q}$, and $L=\mathbb{Q}[\alpha]/(\alpha^{3}+\alpha+1)$. Then the
multiplication in $M^{3}(L)$ is defined by

$(x_{1},x_{2},x_{3})*(y_{1},y_{2},y_{3})=$
$=(x_{1}y_{1}-x_{2}y_{3}-x_{3}y_{2},x_{1}y_{2}+x_{2}y_{1}-x_{2}y_{3}-x_{3}y_{2}-x_{3}y_{3},x_{1}y_{3}+x_{2}y_{2}+x_{3}y_{1}-x_{3}y_{3}).$

##  6\. Possible generalizations

In [2, 3] monoids on affine surfaces were studied over an algebraically closed
field of characteristic zero. We believe that our technique can help to
generalise the results of these papers to the case of non-closed fields of
characteristic zero. So we formulate

Question 1: is it possible to reach similar classification for monoids on
affine surfaces over an arbitrary (not necessary algebraically closed) field
$K$ of characteristic zero?

However, obtaining such classification in positive characteristic can be much
harder problem even if the ground field is closed, because of the nontrivial
commutative unipotent groups, see, for example, [14, Exercise 8.8]. So let us
formulate

Question 2: is it possible to reach similar classification for monoids on
affine spaces $\mathbb{A}_{K}^{n}$ over a field $K$ of characteristic $p$,
where $p$ is a prime number? Consider first the cases where $K$ is
algebraically closed and $n=2$.

## References

  * [1] I. Arzhantsev, S. Bragin and Y. Zaitseva, Commutative algebraic monoid structures on affine spaces Communications in Contemporary Mathematics, Vol. 22, No. 08 (2020), P. 1950064: 1.
  * [2] B. Bilich, Classification of noncommutative monoid structures on normal affine surfaces, Preprint: https://arxiv.org/abs/2106.04884.
  * [3] S. Dzhunusov and Y. Zaitseva, Commutative algebraic monoid structures on affine surfaces, Forum Mathematicum 33 (2021), no. 1, 177-191.
  * [4] D. Eisenbud and J. Harris, The Geometry of Schemes, Springer, New York, 2000.
  * [5] J. E. Humphreys, Linear Algebraic Groups, Springer, New York, 1975.
  * [6] B. Poonen, Rational Points on Varieties, American Mathematical Society, 2017.
  * [7] M. Putcha, Linear Algebraic Monoids, London Math. Soc. Lecture Notes, vol. 133, Cambridge Univ. Press. Cambridge, 1988.
  * [8] L. Renner, Linear Algebraic Monoids, Encyclopaedia Math. Sciences 134, Springer, Berlin, 2005.
  * [9] A. Rittatore, Algebraic monoids and group embeddings, Transform. Groups 3 (1998), no. 4, 375–396.
  * [10] A. Rittatore, Algebraic monoids with affine unit group are affine, Transform. Groups 12 (2007), no. 3, 601-605.
  * [11] J. P. Serre, Galois Cohomology, Springer-Verlag Berlin Heidelberg, 1997.
  * [12] The Stacks Project Authors, Stacks Project, http://stacks.math.columbia.edu.
  * [13] E. Vinberg, On reductive algebraic semigroups, In: Lie Groups and Lie Algebras, E.B. Dynkin Seminar, S. Gindikin and E. Vinberg, Editors, AMS Transl. 169, 145-182, Amer. Math. Soc., 1995.
  * [14] W. Waterhouse, Introduction to Affine Group Schemes, Springer-Verlag, New York, 1979.


# AuthAttLyzer-V2: Unveiling Code Authorship Attribution using Enhanced
Ensemble Learning Models and Generating Benchmark Dataset

Bhaskar Joshi  International Institute of Information Technology, Hyderabad,
India  Sepideh HajiHosseinKhani  Behaviour-Centric Cybersecurity Center
(BCCC), School of Information Technology, York University, Toronto  Arash
Habibi Lashkari  Behaviour-Centric Cybersecurity Center (BCCC), School of
Information Technology, York University, Toronto

###### Abstract

Source Code Authorship attribution (SCAA) is crucial for software
classification because it provides insights into the origin and behavior of
software. By accurately identifying the author or group behind a piece of
code, experts can better understand the motivations and techniques of
developers. In the cybersecurity era, this attribution helps trace the source
of malicious software, identify patterns in the code that may indicate
specific threat actors or groups, and ultimately enhance threat intelligence
and mitigation strategies. This paper presents “AuthAttLyzer-V2,” a new source
code feature extractor for SCAA, focusing on lexical, semantic, syntactic, and
N-gram features. Our research explores author identification in C ++ by
examining 24,000 source code samples from 3,000 authors. Our methodology
integrates Random Forest, Gradient Boosting, and XGBoost models, enhanced with
SHAP for interpretability. The study demonstrates how ensemble models can
effectively discern individual coding styles, offering insights into the
unique attributes of code authorship. This approach is pivotal in
understanding and interpreting complex patterns in authorship attribution,
especially for malware classification

###### Index Terms:

Source Code Analysis, Source Code Authorship Attribution, Authorship
Attribution, Ensemble Learning, Explainable Learning

##  I Introduction

The source code surpasses its foundational logical structures and algorithms;
it serves as a reflective canvas, capturing the unique creative essence of the
programmer (Holcombe, 2019). Just as an author’s unique handwriting
characterizes their work, one might ponder whether the individuality of a
programmer can be identified within the strokes of code they write (Onan,
2018). This fascinating question lies at the heart of an in-depth
investigation into the concept of coding styles serving as a digital
signature, thereby laying the groundwork for the discipline of Author
Attribution (Gama et al., 2018).

In exploring the existing literature on authorship attribution, we have
dedicated our efforts to systematically categorize the wealth of research into
coherent approaches and pinpoint areas ripe for further inquiry. This endeavor
illuminates the pivotal role of coding style analysis, as exemplified by
studies like (Caliskan-Islam et al., 2015; Frantzeskou et al., 2006; Simko et
al., 2018). These researchers have pioneered techniques for identifying
authors through the distinct patterns in their coding, navigating through the
complexities of dataset diversity and the susceptibility of their methods to
adversarial interference. Additionally, language-specific research (Barlas and
Stamatatos, 2020; Ramezani et al., 2013) has explored authorship attribution
with a focus on particular programming languages, revealing both the potential
and limitations of these approaches. Advances in machine learning (ML) and
deep learning (DL) have further enriched authorship attribution techniques,
offering sophisticated methods for identifying authors, even in the context of
binary code and malware analysis (Mechti and Almansour, 2021; Krsul and
Spafford, 1997; Rosenblum et al., 2011). Despite these advancements, the
research also points out the need for improved defenses against adversarial
attacks, suggesting an ongoing evolution in the field of authorship
attribution (Quiring et al., 2019; Abhishek et al., 2022).

As highlighted in the preceding text, the field of authorship attribution has
seen extensive research. Still, it continues to grapple with challenges such
as scalability (Ding and Samadzadeh, 2004), coding styles (Caliskan-Islam et
al., 2015), evaluation metrics (Amin et al., 2020), and generalizability
(Barlas and Stamatatos, 2020). These issues, especially when related to tasks
like malware authorship identification (Shin et al., 2020), underscore the
critical importance of this domain. In response to these challenges, this
study aims to advance the field by developing an enhanced version of
AuthAttLyzer, incorporating expanded features. Moreover, we propose an
interpretable algorithm designed to elucidate the decision-making process by
integrating SHAP with various machine-learning techniques.

Additionally, this research introduces a novel dataset, BCCC-AuthAtt-2024,
specifically curated for our experiments. This dataset serves as the
foundation for testing a cutting-edge Authorship Attribution methodology,
marking a significant step forward in refining and broadening the scope of
authorship attribution studies. Employing this new dataset, our study
encompassed a broad analysis across 24,000 instances, spanning eight author
categories. The methodology involved the utilization of Random Forest,
Gradient Boosting, and XGBoost algorithms, both with and without the
integration of SHAP for interpretability, to identify the most effective model
for authorship attribution. The results of these comprehensive experiments,
highlighting metrics such as precision, recall, accuracy, and F1-score,
illustrate the efficacy of our feature selection strategy. Moreover, they
reveal the advantages of employing a hybrid approach to achieve enhanced
performance in the analysis of Smart Contracts.

Our contributions in this study are multi-faceted, providing significant
advancements in the realm of authorship attribution in C++ source codes:

  * •

To propose a novel feature taxonomy, spotlighting the attributes derived from
C++ source code, facilitating the development of a more nuanced and
efficacious approach to authorship attribution.

  * •

To introduce an enhanced iteration of AuthAttLyzer, building upon the
foundation laid by AuthAttLyzer (version 1), by integrating additional
pertinent features for a more thorough grasp of the subject at hand.

  * •

To create a new C++ source code Dataset namely BCCC-VolSCs-2023, by having
source codes from 8 different authors, with the primary objective of
implementing the proposed model on a substantial sample size of 24,000
samples.

  * •

To develop and implement an innovative authorship attribution model that
incorporates SHAP for enhanced explainability, utilizing the features of
AuthAttLyzer version 2 to accurately determine code authorship.

The structure of the remainder of this paper is as follows. Section 2 delves
into the existing literature within this research field and identifies the
limitations inherent in current solutions. Section 3 is devoted to an in-depth
discussion of our proposed model. Section 4 outlines the extensive
experiments, results, and implementation of our model. Section 5 thoroughly
analyzes and discusses. Finally, Section 6 presents our conclusions and
suggests directions for future work.

##  II Literature Review

This section provides a summary of previous research works on authorship
attribution and their proposed solutions. In doing so, we aim to categorize
previous works into different branches. The final subsection identifies the
gaps and shortcomings within the existing literature and outlines which of
them we will cover in this research.

Exploring the first category, researchers such as (Caliskan-Islam et al.,
2015; Frantzeskou et al., 2006; Simko et al., 2018) have focused on authorship
attribution through the analysis of coding styles. Initially, (Caliskan-Islam
et al., 2015) highlighted the distinctiveness of coding styles as unique
identifiers for programmers, particularly emphasizing C/C++ languages. Their
Code Stylometry Feature Set (CSFS) surpassed previous methods in accuracy for
attributing authorship. However, issues were raised regarding the dataset’s
representativeness and practical implementation’s feasibility.

Continuing in this category, (Frantzeskou et al., 2006) introduced the Source
Code Author Profiles (SCAP) method, employing byte-level n-gram profiles that
were effective and language-independent, even with sparse training data. SCAP
proved resilient against the absence of comments in source code and could
accurately identify authors in Java and C++ with brief code samples. Yet,
there were concerns about its ability to capture coding styles’ semantic and
logical elements across various languages. Recent progress has also
strengthened classifiers for source code attribution. (Simko et al., 2018)
investigated situations where adversaries manipulate code to cause
misclassification, either by mimicking another author’s style to hide their
identity or falsely implicating others. Their study revealed the
susceptibility of these systems to manipulation by non-expert adversaries. To
craft more robust classifiers, they researched with C/C++ programmers to
evaluate adversary strategies and countermeasures by human analysts and
suggested features to improve system resilience against adversarial
techniques.

Moving to the next category, (Ramezani et al., 2013; Barlas and Stamatatos,
2020) shifted their focus to language-specific approaches for authorship
attribution. In 2013, (Ramezani et al., 2013) explored Persian corpora. They
assessed textual features, including lexical, character, syntactic, and
semantic categories, emphasizing the reliability of features related to used
words and verbs, particularly NLP-based ones. However, the study’s exclusive
focus on Persian limited generalizability and a deeper analysis of feature
interplay and real-world applicability could provide more insights. Moreover,
the scenarios explored may not fully represent diverse authorship styles or
unstructured texts, and a lack of detailed error analysis hinders complete
understanding. Following this idea in 2020, (Barlas and Stamatatos, 2020)
addressed cross-domain attribution challenges crucial for cybersecurity,
digital humanities, and social media analytics. Experiments on various text
genres showed promising results, highlighting its effectiveness in cross-
domain scenarios. They also emphasized the significance of the normalization
corpus in improving attribution accuracy.

Whereas previous research categories concentrated on the analysis of coding
styles and language-specific attributes, a group of researchers introduced a
pioneering concept in authorship attribution through syntactic and semantic
analysis. In 2010, (Chen et al., 2010) introduced a semantic approach that
identifies authorship by analyzing program data flows, which is especially
useful for detecting code theft. Their findings demonstrated resilience even
in the face of code alterations. A few years later, (Sidorov et al., 2014)
introduced an innovative method that generates n-grams by tracing paths within
syntactic trees. Their research, utilizing a corpus from Project Gutenberg,
demonstrated that sn-grams could surpass traditional n-grams in certain
conditions, with Support Vector Machines (SVM) achieving perfect accuracy in
specific instances. However, this method introduces challenges such as
dependency on the language and focusing on literary texts from a specific
period, prompting questions about its effectiveness across various literary
styles and genres.

With the introduction and increasing application of ML and DL, several
significant approaches have emerged in utilizing these technologies for
authorship attribution. (Mechti and Almansour, 2021) underscored the
importance of pattern size in coding analysis, building upon earlier work by
(Krsul and Spafford, 1997) and (Ding and Samadzadeh, 2004) in identifying
features for authorship attribution in C and C++ code. Later, focusing on
binary features, the challenge intensified in binary code analysis, where the
impact of the compilation process on a programmer’s style became a complex
issue. (Rosenblum et al., 2011) tackled this by framing it as a ML challenge,
proposing methods to identify authors within program binaries. Their
experiments showed that a programmer’s unique style could be detected within
binary code, highlighting the importance of authorship attribution across
various domains. (Fabien et al., 2020) introduced BertAA, an advanced DL-based
method for Authorship Attribution, proving its efficacy on datasets such as
Enron Email, Blog Authorship, and IMDb. They also demonstrated the benefits of
incorporating stylometric and hybrid features into an ensemble model for
enhanced performance.

Proceeding in this category, (Zafar et al., 2020) developed a deep metric
learning approach for SCAA, achieving notable accuracy and scalability, as
demonstrated on the Google Code Jam dataset. These developments emphasize the
potential of DL in authorship attribution, especially in identifying
programmers through stylistic nuances in code, which is vital for software
theft detection, digital forensics, and malware analysis. (Lee and Cho, 2022)
identified malware authors through automated analysis, employing six distinct
machine-learning algorithms. Features selected for author identification
included Runtime Modules and Kernel32.dll API, extracted from the automated
analysis, resulting in improved accuracy and efficiency. Building on the
advancements in DL and the insights from the previous category, (Amin et al.,
2020) created a DL model specifically for detecting Android malware behaviors.
This development highlighted the significant potential of DL to bolster
malware detection capabilities.

Exploring the subsequent category, which focuses on binary source code for
authorship attribution, several pioneering proposals have surfaced over time.
In response to Advanced Persistent Threats (APTs) utilizing malware, (Shin et
al., 2020) developed a genetic algorithm-based framework for analyzing
malware. This innovative framework identifies unique features within binary
and source code, achieving an 86% accuracy rate in classifying authors.
Further advancements in malware detection were made by (Benthin, 2022), who
investigated malware binaries to improve authorship attribution methods.

The final category enriches the discussion on the robustness of authorship
attribution techniques, with (Quiring et al., 2019) introducing a strategy to
undermine SCAA by employing adversarial examples. This approach highlights the
vulnerability of current attribution models to intentional attacks,
emphasizing the urgent need for the development of more resilient defense
mechanisms. (Abhishek et al., 2022) tackled the vulnerability of SCAA models
to gradient-based attacks and universal perturbations. They proposed a novel
architecture that employs defensive distillation to improve SCAA’s defenses
against adversarial attacks, managing to achieve up to 95% accuracy on
unmodified code files.

###  II-A Synthesis of Previous Works

A closer examination of previous works on authorship attribution highlights
various areas where limitations become apparent:

  * •

Dataset Dependency: The substantial achievements demonstrated by (Caliskan-
Islam et al., 2015) heavily rely on the Google Code Jam dataset, which raises
questions regarding the universality and generalizability of the proposed
models.

  * •

Scalability Concerns: The literature reveals a gap in exploring the
computational demands and scalability of authorship attribution methods,
leaving their practical industrial application uncertain (Barlas and
Stamatatos, 2020; Mechti and Almansour, 2021; Ding and Samadzadeh, 2004).

  * •

Language-Specific Approaches: The dependence on language-specific features in
some studies suggests limitations in their applicability to diverse
programming environments, necessitating cross-language validation (Sidorov et
al., 2014).

  * •

Evolving Coding Styles: The dynamic nature of coding practices and the
evolution of individual styles are not fully addressed, potentially
undermining the long-term accuracy of attribution models (Caliskan-Islam et
al., 2015; Frantzeskou et al., 2006; Simko et al., 2018).

  * •

Model Evaluation Metrics: There is an observed emphasis on accuracy, with
other critical evaluation metrics such as precision, recall, and F1 scores
receiving less attention, which is vital for a rounded assessment of
classification models (Amin et al., 2020; Quiring et al., 2019; Abhishek et
al., 2022).

  * •

Code Analysis Limitations: Combining binary and source code analysis for
authorship attribution shows promise but lacks optimal accuracy, particularly
in malware profiling. Despite innovative approaches like genetic algorithms,
achieving satisfactory classification accuracy remains challenging. Further
advancement of feature extraction is necessary to enhance the effectiveness of
attribution methods in cybersecurity. (Benthin, 2022; Shin et al., 2020)

  * •

Linguistic Generalizability: Concentrating on specific languages within
certain studies could impede extending their results to other linguistic
contexts, underscoring the need for studies encompassing a broader linguistic
spectrum (Ramezani et al., 2013; Barlas and Stamatatos, 2020).

  * •

Code Manipulation Resilience: While some methods, like SCAP, show resilience
to certain forms of code manipulation, their robustness against a wider array
of alterations has not been thoroughly investigated (Frantzeskou et al.,
2006).

In this study, we address objectives 1, 2, 4, 5, 6, and 8 through the
development of a newly enhanced feature extractor, AuthAttLyzer version 2,
designed to improve authorship attribution by expanding its feature set. We
also design and build an explainable AI model, training it on the newly
compiled BCCC-AuthAtt-2024 dataset.

##  III Proposed Model

This section introduces the proposed model architecture for author attribution
in C++ code. Initially, we detail the step-by-step methodology employed in the
design of our model architecture. Subsequently, we compare two leading
interpretability techniques, Shapley Additive Explanations (SHAP) and Local
Interpretable Model-agnostic Explanations (LIME), highlighting their
advantages and relevance to our scenario. Following that, we offer an
extensive overview of the features incorporated into our model, including
layout, dynamic, style, N-gram, and graph-based elements crucial for
identifying the distinctive coding styles of individual authors.

###  III-A Model Architecture

This study employs a detailed methodology for attributing authorship within
the realm of SCAA, organized into several crucial phases, each designed to
capture and analyze the distinctive coding patterns of various authors:

  * •

Collection of Individual Source Code Corpora: The initial phase focuses on
gathering individual source code datasets. Leveraging the open-source
Codeforces platform, we compile various coding examples to encompass various
programming styles.

  * •

Data Pre-Processing: The raw code samples undergo a meticulous pre-processing
routine following collection. This involves cleaning and structuring the data,
setting the stage for effective feature extraction and further analysis.

  * •

Feature Extraction from Source Code (AuthAttLyzer-V2): At the heart of our
approach is extracting distinctive features from the source code. We pinpoint
and extract 54 key features that reflect the unique coding styles of
individuals, encompassing lexical, syntactic, and structural dimensions. These
features form the foundation of our author profiling framework.

  * •

Ensemble Models for Author Attribution: Our methodology utilizes ensemble ML
techniques, specifically Random Forest and Gradient Boosting models, renowned
for their efficacy in intricate classification scenarios. These models are
adept at uncovering nuanced coding patterns distinct to each author. By
integrating SHAP (SHapley Additive Explanations), we achieve high predictive
accuracy and ensure transparency in how model decisions are made. Combining
ensemble models with explainable AI methods is crucial for dissecting the
complex features that define an author’s coding style.

  * •

Model Validation on Data: The concluding phase tests the model’s predictive
performance on a separate dataset of unseen code samples. This step is
essential to assess the model’s generalizability and success in accurately
attributing source code to the rightful authors.

Through this structured approach, our research aims to profile authors
effectively based on their coding practices using advanced ML models.

###  III-B Model Selection

In the pursuit of transparency and accountability within AI-powered decisions,
Explainable AI (XAI) techniques such as SHAP (Shapley Additive Explanations)
(Lundberg and Lee, 2017) and LIME (Local Interpretable Model-agnostic
Explanations) (Mishra et al., 2017) play pivotal roles. These methodologies
aim to illuminate the decision-making processes of complex models, providing
case-specific insights essential for fostering trust and understanding in AI
applications. By comparing and contrasting SHAP with LIME, we elucidate the
reasons behind favoring SHAP for enhancing model interpretability,
particularly in intricate tasks such as C++ code authorship attribution.

LIME offers interpretability by approximating the model locally using a
simpler, interpretable model that captures the impact of significant features
on specific decisions. Its principle is encapsulated in the formula:

$E(x)=\underset{g\in G}{\mathrm{argmin}}\,L(f,g,\pi_{x})+\Omega(g)$ (1)

Here, $L$ represents the loss function measuring discrepancies between the
surrogate model ($g$) and the original model ($f$), with $\Omega(g)$ denoting
the surrogate model’s complexity. LIME’s local surrogate models aim to balance
fidelity to the original complex model with the simplicity of explanations.

SHAP, in contrast, builds on the theoretically grounded Shapley values from
cooperative game theory, offering a more comprehensive and equitable approach
to attributing feature importance. The SHAP formula is given as:

$\phi_{j}(\text{val})=\sum_{S\subseteq
M\setminus\\{j\\}}\frac{|S|!(m-|S|-1)!}{m!}[\text{val}(S\cup\\{j\\})-\text{val}(S)]$
(2)

This formula calculates the marginal contribution of each feature across all
possible feature combinations, ensuring a fair and transparent attribution of
importance to each feature. SHAP’s adherence to properties such as efficiency,
symmetry, dummy, and additivity further underscores its robustness in
interpretability.

The preference for SHAP in our analysis, especially for the nuanced domain of
C++ code authorship attribution, stems from its ability to provide global
interpretability with local fidelity. SHAP not only aligns with the rigorous
requirements of transparency but also excels in dissecting complex model
predictions into understandable contributions from each feature, as seen in:

$g(z^{\prime})=\phi_{0}+\sum_{i=1}^{m}\phi_{i}z^{\prime}_{i}$ (3)

This explanation model, where $z^{\prime}$ represents the binary
representation of feature presence, provides a detailed understanding of how
each feature influences the model’s prediction. It showcases SHAP’s superior
capability in handling the complexity and non-linearity inherent in C++ code
structures, making it a preferred choice over LIME for enhancing model
interpretability.

In essence, the strategic choice of SHAP over LIME for our task is justified
by SHAP’s comprehensive framework that merges intuitive understanding with the
equitable theoretical foundation of Shapley values. This not only ensures a
profound understanding of the contribution of each feature to the model’s
decision but also significantly advances the interpretability and
trustworthiness of complex models in the field of AI and ML.

###  III-C Features Extraction

Feature extraction is crucial for Authorship Attribution, serving as the base
for identifying unique coding patterns of different authors. By analyzing code
characteristics, we gain insights that improve author identification and
contribute to Cybersecurity. This process is key to better understanding and
managing source code, improving security, maintainability, and standards
compliance. Below, we describe the extracted features using our new Author
Attribution Analyzer tool, AuthAttLyzer-V2.

####  III-C1 Features Description

In this section, we delve into the detailed analysis of features designed to
improve outcomes in Authorship Attribution, with a thorough evaluation set for
the ”Experiments” section. Figure 1 depicts the taxonomy of feature
descriptions. These features are crucial for analyzing and understanding code,
providing a range of practical applications:

  * •

Code Cloning Detection: Using character-level n-grams, we can accurately
identify duplicate code fragments. When two segments of code exhibit a high
similarity in their character-level n-grams, it suggests they are clones or
direct copies of each other.

  * •

Code Style Analysis: Word-level n-grams serve as a tool for evaluating
conformity to coding standards and stylistic guidelines. Analyzing prevalent
word-level patterns and their variations helps in pinpointing deviations from
established coding norms.

  * •

Code Complexity Assessment: The application of word-level n-grams aids in
assessing the complexity of code. Identifying a frequent occurrence of complex
constructs, such as nested loops or deep conditional statements, indicates a
higher level of code complexity.

  * •

Code Anomaly Detection: Both character and word-level n-grams are instrumental
in spotting anomalies or potential security flaws. The detection of unusual
character combinations or specific sequences of words (for instance, “eval”
followed by a string) can prompt security warnings.

  * •

Language Identification: Character-level n-grams are effective in determining
the programming language of a piece of code. Each programming language has a
unique n-gram profile, enabling precise classification of code snippets.

  * •

Code Summarization: Word-level n-grams facilitate the creation of code
summaries or documentation. Recognizing frequent constructs and comments
allows for generating abstract descriptions outlining code functionalities.

The analysis of character and word-level n-grams yields significant insights
into the structure, style, and content of source code. These features are
indispensable across various domains, including code analysis, quality
assessment, security examination, and automated documentation. They empower
developers and code reviewers to delve deeper into codebases, identify
potential issues, and make well-informed code refinement and enhancement
decisions. The proposed feature extraction named AuthAttLyzer-V2 is an upgrade
of our Authorship Attribution tool, enhanced better to identify coding styles
and patterns in C++ programs. This version represents a significant
improvement in helping to ensure software quality and security.

Figure 1: Taxonomy: Features Description

Layout Feature ID |  Feature Focus |  Feature Description
---|---|---
tl_1 |  Operator Format |  Measures the average number of whitespaces surrounding operators within the code.
tl_2 |  Frequency of left braces on the end of lines including ’if(condition)’ |  Examines how often left curly braces appear at the end of lines containing ’if(condition)’ statements.
tl_3 |  Percentage of blank lines |  Calculates the percentage of blank lines in the code, indicating code organization and readability.
tl_4 |  Average number of leading whitespaces per line |  Quantifies the average indentation level across the code, reflecting code structure and formatting consistency.
tl_5 |  Format of for loop |  Percentage of whitespaces between left and right parentheses of ’for(…)’ to all ’for’ loops.
tl_6 |  Format of for loop |  Whether there is at least a whitespace between left and right parentheses of ’for(…)’
tl_7 |  ln(numTabs/length) |  Log of the number of tab characters divided by file length in characters
tl_8 |  ln(numSpaces/length) |  Log of the number of space characters divided by file length in characters
tl_9 |  ln(numEmptyLines/length) |  Log of the number of empty lines divided by file length in characters, excluding leading and trailing lines
tl_10 |  WhiteSpaceRatio |  The ratio between the number of whitespace characters (spaces, tabs, and newlines) and non-whitespace characters
tl_11 |  NewLineBeforeOpenBrace |  Determines whether most code-block braces begin with a newline character.
tl_12 |  TabsLeadLines |  Assesses whether spaces or tabs are predominantly used for indentation in the code.

TABLE I: Layout Features

Dynamic Feature ID |  Feature Focus |  Description
---|---|---
$td_{1}$ |  Extraction of Function Calls |  Focuses on the extraction of function calls within the provided C++ code.
$td_{2}$ |  Measurement of Total Memory Usage |  Involves measuring the total memory usage of the C++ program
$td_{3}$ |  Measurement of Length of Disassembled Code |  This feature measures the length of disassembled code generated by a compiler or disassembler tool. It compiles the provided C++ code to assembly language, reads the generated code, and reports its length, which can be indicative of the complexity of the code.
$td_{4}$ |  Extraction of Time Information |  Extracts time of execution information related to the execution of the C++ program.

TABLE II: Dynamic Feature Descriptions

Style Feature ID |  Feature Focus |  Feature Description
---|---|---
$ts_{1}$ |  Comment Lines |  Measures the number of lines in the code that are comments, providing insights into code documentation.
$ts_{2}$ |  Percentage of Comments |  Calculates the percentage of lines that are comments relative to the total number of lines, indicating the level of code documentation.
$ts_{3}$ |  Variable Name Length |  Evaluates the average length of variable names in the code, reflecting naming conventions and readability.
$ts_{4}$ |  Frequency of Loops |  Comparing the frequency of the keyword “for” with that of “while”
$ts_{5}$ |  Frequency of Control Statements |  Compares the usage of ”if” with that of ”switch” statements, providing insights into conditional logic within the code.
$ts_{6}$ |  Percentage of Static Global Variables |  Calculates the percentage of lines containing static global variable declarations, indicating code structure and organization.
$ts_{7}-ts_{9}$ |  Access Modifiers |  Measures the use of access modifiers (public, private, protected), offering insights into code visibility and encapsulation.
$ts_{10}$ |  Kinds of Operators |  Identifies and lists the unique operators used in the code, revealing the diversity of operations performed.
$ts_{11}$ |  Percentage of Operators |  Calculates the percentage of lines containing operators relative to the total number of non-comment lines, indicating the complexity of operations.
$ts_{12}-ts_{15}$ |  Percentage of Methods |  Breaks down the percentage of lines with methods by their return types (int, char, void, String), providing insights into method distribution.
$ts_{16}$ |  Percentage of Methods (Overall) |  Measures the overall percentage of lines with methods relative to the total number of non-comment lines, revealing code structure.
$ts_{17}-ts_{20}$ |  Variable Name Characteristics |  Analyzes variable names for the presence of underscores, numbers, and uppercase starting variables, Camel-Case style
$ts_{21}$ |  Number of Variables |  Quantifies the total number of variables declared in the code, offering insights into code complexity and data management.
$ts_{22}$ |  Percentage of Variables |  Calculates the percentage of lines containing variable declarations relative to the total number of non-comment lines, revealing variable density.
$ts_{23}$ |  Use of ”goto” Statement |  Indicates whether the ”goto” statement is used in the code, reflecting code control flow.
$ts_{24}$ |  Use of ”auto” Statement |  Indicates whether the ”auto” statement is used in the code.
$ts_{25}$ |  Use of ”struct” |  Analyzes the use of ”struct”

TABLE III: Style Features

Dynamic Feature ID Feature Focus Description $tn_{1}-tn_{5}$ Character n-gram
Frequency of character-level n-grams $tn_{6}-tn_{9}$ Word n-gram Frequency of
word-level n-grams

TABLE IV: N-Gram based Features

Graph Based Feature ID Feature Focus Description $tg_{1}$ Ast node bigram Term
frequency AST node bigrams $tg_{2}$ Ast node types Term frequency of 58
possible AST node type excluding leaves $tg_{3}$ Ast node maxdepth Maximum
depth of an AST node $tg_{4}$ Code in Ast leaves Term frequency of code
unigrams in AST leaves

TABLE V: Graph based Features

##  IV Experiments

This section presents a concise yet comprehensive overview of our empirical
investigation into C++ code authorship attribution. We commence with Strategic
Algorithm Selection, elucidating the rationale behind our choice of ML models.
This is followed by Model Performance Analysis, where we assess the efficacy
of these models against a large dataset. Data Curation and Preparation detail
the efforts to refine our dataset, while Metrics for Success define our
evaluation criteria. Experimentation Framework outlines the setup for our
research, leading to Analysis of Results, which reveals the key findings of
our study. Each step is meticulously designed to ensure a robust and
insightful exploration into identifying unique authorial styles in code.

###  IV-A Data Preparation

Our evaluation focuses on analyzing the source code from actual authors who
have tackled numerous problems on the Codeforces platform, a hub for
algorithmic challenges where participants can choose their preferred
programming language for solution submission (Mirzayanov et al., 2020). This
platform offers publicly accessible source codes from consistent contributors
who are experienced in problem-solving over time. By selecting authors who
have a history of genuine contributions and have tackled a diverse range of
problems, we ensure the integrity of our dataset and include individuals who
have demonstrated long-term engagement with the platform. This methodology
allows us to capture any potential evolution in coding styles.

In terms of programming languages, C++ emerges as the most favored, followed
by Java and Python. Our research into source code stylometry primarily targets
C++ and C, chosen for their prevalence in competitive programming and the
availability of efficient parsers for these languages. This study assesses the
efficacy of multiple ML models in authorship attribution for C++ code using a
newly generated dataset (BCCC-AuthAtt-2024) including 24,000 code samples (8
samples per author) from 3,000 authors. Our focus is on extracting a
comprehensive array of features, including lexical, semantic, syntactic, and
N-gram components, essential for identifying the unique coding styles of
individual authors. The goal is to accurately predict an author’s identity
based on their unique coding style.

###  IV-B Evaluation Metrics

The evaluation metrics for assessing the performance of designed and
implemented explainable ML model, include several key statistical measures.
These measures are based on outcomes categorized as True Positives (correct
identifications of an author’s code), True Negatives (correct rejections of
non-author code), False Positives (incorrectly attributing code to the
specific author), and False Negatives (missing an author’s code). The primary
metrics derived from these outcomes include:

  * •

Accuracy: This measures the overall correctness of the model, calculated as
the ratio of correctly identified instances (both positive and negative) to
all instances.

  * •

Precision: This assesses the accuracy of the model’s positive predictions,
indicating the proportion of positive identifications that are correct.

  * •

Recall: This metric evaluates the model’s ability to identify all relevant
instances, calculated as the ratio of correctly identified positive instances
to all actual positive instances.

  * •

F1-score: This is a harmonic mean of precision and recall, providing a single
metric that balances both aspects to evaluate the model’s performance
comprehensively.

The aforementioned metrics serve as the primary evaluation criteria for our
model’s performance on the BCCC-AuthAtt-2024 dataset, ensuring a comprehensive
understanding of its effectiveness in source code-based authorship
attribution.

###  IV-C Experimentation Setup

The experiments for the implemented model were conducted using the Python
programming language, version 3.8, on a system running Microsoft Windows 10
Home Version 20H2. Our primary development and evaluation environment included
a workstation equipped with 16 GB of RAM, which provided a robust platform for
handling the computational demands of the ML models. We employed several other
libraries to aid in data preprocessing, model evaluation, and statistical
analysis. NumPy (version 1.19) and Pandas (version 1.2) were used for data
manipulation and analysis. Scikit-learn (version 0.24) was employed for its
robust ML algorithms and tools, particularly for pre-processing steps and
evaluation metrics.

###  IV-D Model Performance

Our research investigates the effectiveness of various ML models for
attributing authorship using the BCCC-AuthAtt-2024 dataset. We meticulously
evaluated six different models, each chosen for their relevance and potential
contributions to ML’s theoretical and practical realms, aiming to determine
their efficacy in code authorship attribution.

  * •

Random Forest (RF): RF stands as an ensemble learning method, valued for its
resistance to overfitting in scenarios with high-dimensional data. Its
capability to offer insights through feature importance analysis renders it an
effective baseline model. RF was selected for its combination of simplicity,
dependability, and interpretability—key attributes for preliminary model
evaluation.

  * •

Random Forest with SHAP (RF-SHAP): RF-SHAP enhances RF by incorporating SHAP
explanations, shedding light on how individual features contribute to
predictions. This model is favored for maintaining RF’s core advantages while
significantly boosting interpretability, offering deeper insights into the
coding styles specific to authors.

  * •

Gradient Boosting (GB): GB stands out for its methodical approach of building
models incrementally, enhancing precision in handling complex tasks and large
datasets. It adeptly identifies non-linear relationships and complex
interactions among features. GB was chosen for its potential to surpass RF in
terms of accuracy.

  * •

Gradient Boosting with SHAP (GB-SHAP): GB-SHAP marries the accuracy
improvements of GB with SHAP’s explanatory depth, delivering accurate
predictions and clarifying the impact of each feature. This model appeals for
its blend of high precision and improved interpretability over the standard
GB.

  * •

XGBoost: XGBoost is recognized for its optimized gradient-boosting framework,
which offers enhanced training speed and the possibility of achieving greater
accuracy. It employs advanced regularization to minimize overfitting, making
it particularly effective for large, complex datasets. XGBoost was selected
for its robust performance in analyzing intricate patterns.

  * •

XGBoost with SHAP (XGB-SHAP): XGB-SHAP combines XGBoost’s high accuracy with
SHAP’s analytical depth, setting a new standard for precision and
interpretability in our study. This model is ideally suited for research
requiring both detailed model decision insights and superior accuracy,
representing the epitome of performance and interpretability within our array
of models.

Through this analysis, our goal is to discern the distinct coding styles of
authors, leveraging advanced ML models to accurately attribute authorship,
while also providing comprehensive insights into the decision-making processes
of these models. Table VI presents the performance metrics of the evaluated ML
models using the BCCC-AuthAtt-2024 dataset.

TABLE VI: Performance metrics of ML models for code authorship attribution.

Model | Accuracy (%) | Precision (%) | Recall (%) | F1-score (%)
---|---|---|---|---
Random Forest | 67.5 | 68.2 | 66.7 | 67.4
Random Forest with SHAP | 78.4 | 79.1 | 77.7 | 78.4
Gradient Boosting | 69.7 | 70.4 | 69.0 | 69.7
Gradient Boosting with SHAP | 75.1 | 75.8 | 84.4 | 79.9
XGBoost | 70.8 | 71.5 | 70.1 | 70.8
XGBoost with SHAP | 81.2 | 81.9 | 80.5 | 81.2

##  V Analysis and Discussion

The study aimed to advance the field of authorship attribution by enhancing
the AuthAttLyzer tool to its second version, AuthAttLyzer V2, which now
incorporates 54 distinct features for the analysis of C++ code samples. To
improve the model’s explainability, we integrated SHAP (SHapley Additive
exPlanations) with various ML algorithms, providing insight into how each
feature influences the model’s predictions. This methodology was applied to a
newly established benchmark consisting of 24,000 C++ code samples from eight
different authors, aiming to evaluate the model’s performance across multiple
metrics rigorously.

Our findings reveal that XGBoost with SHAP achieves a commendable balance in
accuracy, precision, recall, and F1-score, as illustrated by a comprehensive
comparison in Figure 2. This equilibrium in performance metrics underscores
the model’s robustness in attributing authorship accurately across a varied
dataset, demonstrating its effectiveness in distinguishing among authors’
coding styles. The integration of SHAP bolstered the model’s predictive
accuracy and its interpretability, enabling users to understand the rationale
behind each attribution, a critical aspect for applications in both academic
and security contexts.

This groundbreaking work with AuthAttLyzer V2 and its integration with an
XGBoost model, enhanced by SHAP, sets a new benchmark in the field of
authorship attribution. Beyond laying a solid foundation for future research
to refine authorship identification methods, it significantly extends the
applications of these technologies. Importantly, it introduces a powerful
cybersecurity and malware analysis tool, where identifying malicious code
authors can be crucial in tracking cyber threats and understanding attack
methodologies. This work opens new avenues for research in both code
authorship understanding and the broader context of cybersecurity, suggesting
exciting directions for future investigations in code analysis.

Figure 2: Comparative Performance Analysis of Different Models

##  VI Conclusion and Future Work

This study unveils AuthAttLyzer-V2, a cutting-edge feature extraction tool for
SCAA, marking a significant advancement in accurately identifying code
authors, particularly within the cybersecurity realm. AuthAttLyzer-V2 adopts a
holistic approach, utilizing a meticulously selected combination of lexical,
semantic, syntactic, and N-gram features to achieve this goal. Our analysis of
24,000 C++ source code samples from 3,000 authors demonstrates the power of
combining Random Forest, Gradient Boosting, and XGBoost models with SHAP for
enhanced interpretability. This approach effectively navigates the intricate
patterns in C++ code, surpassing simpler algorithms and establishing a robust
basis for identifying distinct coding styles.

The strategic use of XGBoost paired with SHAP results in an outstanding
performance, demonstrated by accuracy, precision, recall, and F1-score rates
all around 81.2%, 81.9%, 80.5%, and 81.2%, respectively. SHAP’s transformative
impact in clarifying the factors driving model decisions enriches our
understanding, corroborates our results, and offers valuable perspectives for
ongoing and future applications. AuthAttLyzer-V2’s ability to accurately trace
code to its authors sheds light on program origins and behaviors. This
research advances the precision and practicality of authorship attribution and
strengthens cybersecurity defenses, providing a robust basis for future
explorations in this critical field.

Looking ahead, code authorship attribution offers exciting opportunities for
growth and new ideas. By using the models we created in this study on more
types of programming languages, we’re getting close to being able to profile
any code universally. This could help reduce the differences between various
coding languages. Further exploration into the depths of model features and
their interactions through advanced interpretability techniques holds the
potential to unravel the intricacies behind author identification. This could
lead to a more nuanced understanding of authorship patterns and motivations.
Applying interpretability tools like SHAP in real-world settings could
revolutionize how developers and forensic investigators approach code
authorship analysis, providing them unparalleled precision and confidence.
This research has set the groundwork for understanding code authorship better,
leading to a future where we can more effectively analyze and protect the
safety and reliability of software worldwide.

## Availability

The source code for Authorship Attribution Analyzer “AuthAttLyzer-V2” and the
generated dataset “BCCC-AuthAtt-2024” will be made available on our website
[5].

## Acknowledgements

The authors acknowledge the grant from Canada Research Chair - Tier II
(#CRC-2021-00340) and the Mitacs Global Research Internship (GRI) grant for
supporting this research by providing the research internship opportunity.

## References

  * [1] Abhishek, Vombatkere, Chopra, N., and Habibi Lashkari, A. (2022). Authattlyzer: A robust defensive distillation-based authorship attribution framework. In Proceedings of the 2022 12th International Conference on Communication and Network Security, pages 43–50.
  * [2] Amin, M., Tanveer, T. A., Tehseen, M., Khan, M., Khan, F. A., and Anwar, S. (2020). Static malware detection and attribution in android byte-code through an end-to-end deep system. Future Generation Computer Systems, 102:112–126.
  * [3] Barlas, G. and Stamatatos, E. (2020). Cross-domain authorship attribution using pre-trained language models. In Artificial Intelligence Applications and Innovations: 16th IFIP WG 12.5 International Conference, AIAI 2020, Neos Marmaras, Greece, June 5–7, 2020, Proceedings, Part I 16, pages 255–266. Springer.
  * [4] (BCCC), B.-C. C. C. (2024a). Authorship attribution analyzer version 2 (authattlyzer-v2).
  * [5] (BCCC), B.-C. C. C. (2024b). Source code authorship attribution dataset 2024 (bccc-authatt-2024).
  * [6] Benthin, M. (2022). Attributing malware binaries to threat actors based on authorship style.
  * [7] Caliskan-Islam, A., Harang, R., Liu, A., Narayanan, A., Voss, C., Yamaguchi, F., and Greenstadt, R. (2015). De-anonymizing programmers via code stylometry. In 24th USENIX Security Symposium (USENIX Security 15), pages 255–270.
  * [8] Chen, R., Hong, L., Lü, C. C., and Deng, W. (2010). Author identification of software source code with program dependence graphs. In 2010 IEEE 34th Annual Computer Software and Applications Conference Workshops, pages 281–286. IEEE.
  * [9] Ding, H. and Samadzadeh, M. H. (2004). Extraction of java program fingerprints for software authorship identification. Journal of Systems and Software, 72(1):49–57.
  * [10] Fabien, M., Villatoro-Tello, E., Motlicek, P., and Parida, S. (2020). Bertaa: Bert fine-tuning for authorship attribution. In Proceedings of the 17th International Conference on Natural Language Processing (ICON), pages 127–137.
  * [11] Frantzeskou, G., Stamatatos, E., Gritzalis, S., and Katsikas, S. (2006). Effective identification of source code authors using byte-level information. In Proceedings of the 28th International Conference on Software Engineering, pages 893–896.
  * [12] Gama, F., Marques, A. G., Leus, G., and Ribeiro, A. (2018). Convolutional neural network architectures for signals supported on graphs. IEEE Transactions on Signal Processing, 67(4):1034–1049.
  * [13] Holcombe, A. O. (2019). Contributorship, not authorship: Use credit to indicate who did what. Publications, 7(3):48.
  * [14] Krsul, I. and Spafford, E. H. (1997). Authorship analysis: Identifying the author of a program. Computers & Security, 16(3):233–257.
  * [15] Lee, S. and Cho, J. (2022). Malware authorship attribution model using runtime modules based on automated analysis. JOIV: International Journal on Informatics Visualization, 6(1-2):214–220.
  * [16] Lundberg, S. M. and Lee, S.-I. (2017). A unified approach to interpreting model predictions. Advances in Neural Information Processing Systems, 30.
  * [17] Mechti, S. and Almansour, F. (2021). An orderly survey on author attribution methods: From stylistic features to machine learning models.
  * [18] Mirzayanov, M., Pavlova, O., MAVRIN, P., Melnikov, R., Plotnikov, A., Parfenov, V., and Stankevich, A. (2020). Codeforces as an educational platform for learning programming in digitalization. Olympiads in Informatics, 14(133-142):14.
  * [19] Mishra, S., Sturm, B. L., and Dixon, S. (2017). Local interpretable model-agnostic explanations for music content analysis. In ISMIR, volume 53, pages 537–543.
  * [20] Onan, A. (2018). An ensemble scheme based on language function analysis and feature engineering for text genre classification. Journal of Information Science, 44(1):28–47.
  * [21] Quiring, E., Maier, A., and Rieck, K. (2019). Misleading authorship attribution of source code using adversarial learning. In 28th USENIX Security Symposium (USENIX Security 19), pages 479–496.
  * [22] Ramezani, R., Sheydaei, N., and Kahani, M. (2013). Evaluating the effects of textual features on authorship attribution accuracy. In ICCKE 2013, pages 108–113. IEEE.
  * [23] Rosenblum, N., Zhu, X., and Miller, B. P. (2011). Who wrote this code? identifying the authors of program binaries. In Computer Security–ESORICS 2011: 16th European Symposium on Research in Computer Security, Leuven, Belgium, September 12-14, 2011. Proceedings 16, pages 172–189. Springer.
  * [24] Shin, G.-Y., Kim, D.-W., and Han, M.-M. (2020). The attacker group feature extraction framework: Authorship clustering based on genetic algorithm for malware authorship group identification. Journal of Internet Computing and Services, 21(2):1–8.
  * [25] Sidorov, G., Velasquez, F., Stamatatos, E., Gelbukh, A., and Chanona-Hernández, L. (2014). Syntactic n-grams as machine learning features for natural language processing. Expert Systems with Applications, 41(3):853–860.
  * [26] Simko, L., Zettlemoyer, L., and Kohno, T. (2018). Recognizing and imitating programmer style: Adversaries in program authorship attribution. Proc. Priv. Enhancing Technol., 2018(1):127–144.
  * [27] Zafar, S., Sarwar, M. U., Salem, S., and Malik, M. Z. (2020). Language and obfuscation oblivious source code authorship attribution. IEEE Access, 8:197581–197596.