\documentclass[a4paper]{article}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[british]{babel}
\usepackage{bigfoot}
\usepackage{lmodern}
\usepackage{microtype}
\usepackage{longtable}
\usepackage{array}
\usepackage{graphicx}
%\usepackage{showframe}
%\overfullrule=5pt

\usepackage{amsmath,amssymb,amsthm}
\usepackage{url}
\usepackage{mleftright}

\day=20
\month=06
\year=2023
\newcommand{\subs}{\subseteq}%
\newcommand{\defeq}{\mathrel{\mathop:}=}
\newcommand{\set}[1]{\mleft\{#1\mright\}}
\newcommand{\arii}[1]{^{[#1]}}%arity_top
\DeclareRobustCommand{\lset}[2]{\left\{\left.#1\ \vphantom{#2}\right|\ #2\right\}}
\newcommand{\deltarelation}[1][A]{\Delta_{#1}^{(4)}}%
\let\funset=\mathcal%
\newcommand{\Bcl}[1]{\mathsf{#1}}% identifiers for Boolean clones
\newcommand{\aP}{\mathbf{aP}}%
\newcommand{\AP}{\mathbf{AP}}%
\newcommand{\SL}{\mathbf{SL}}%
\newcommand{\Ltwo}{\mathbf{L}_2}%
\newcommand{\algwops}[2]{\apply{#1; #2}}
\newcommand{\alg}[1]{\mathbf{#1}}
\newcommand{\mathff}[1]{{\boldsymbol{#1}}}% bold tuples
\newcommand{\apply}[1]{\left(#1\right)}
\newcommand{\fname}[1]{\url{#1}}
\newcommand{\funcname}[1]{\fname{#1}}%
%
%old:
\newcommand{\N}{\mathbb{N}}%
\newcommand*{\grantno}{P33878}%
\newcommand*{\arxivid}{2309.00478}%
\newcommand{\doi}[1]{doi:~\url{https://doi.org/#1}.}%

\newtheorem*{example}{Example}

\begin{document}
\title{Systems for equational additivity%
\thanks{Support by the Austrian Science Fund (FWF),
        grant \grantno\ is gratefully acknowledged.}}
\author{Mike Behrisch\thanks{%
Institute of Discrete Mathematics and Geometry, TU~Wien, Wien, Austria}
\thanks{Institut f\"ur Algebra, Johannes Kepler Universit\"at Linz,
Austria}
\thanks{\texttt{https://orcid.org/0000-0003-0050-8085}}
\and
Bernardo Rossi\footnotemark[3]
\thanks{\texttt{https://orcid.org/0000-0002-0404-6634}}
\and
Erhard Aichinger\footnotemark[3]
\thanks{\texttt{https://orcid.org/0000-0001-8998-4138}}
}%
\date{\today}
\maketitle
\enlargethispage{1.5ex}

\section*{Overview}
This data set provides supplementary material supporting the verification of
the solution sets of several systems of equations appearing in~\cite{ABR2023}
that ensure a property of algebraic systems called \emph{equational
additivity}, cf.~\cite{Pin17a}. By~\cite[Theorem~2.5]{DanMyaRem10}, for
an algebraic system $\alg{A}= \algwops{A}{(f)_{f\in\funset{F}}}$
on a finite set~$A$, equational additivity is
characterised by the fact that the relation
\[\deltarelation \defeq \lset{(x,y,u,v)\in A^4}{x=y \lor u=v}\]
is the set of solutions of a finite system of quaternary term equations
over~$\alg{A}$; in other words, $\alg{A}$ is equationally additive
if there is $n\in\N\setminus\set{0}$ and there are quaternary terms
$s_1,\dotsc,s_n,t_1,\dotsc,t_n$ over the language of~$\alg{A}$ such that
\[\deltarelation = \lset{\mathff{x}\in A^4}{
s_1(\mathff{x}) = t_1(\mathff{x})\land\dotsm\land
s_n(\mathff{x}) = t_n(\mathff{x})}.
\]
\par
The article~\cite{ABR2023} relies on the (non-)expressibility
of~$\deltarelation$ via certain systems of equations in the
subsequently listed sections (for the meaning of the respective
function symbols we refer the esteemed reader to~\cite{ABR2023}, the
systems of equations are merely listed here for better recognisability
in~\cite{ABR2023}):
\begin{description}
\item[Section~6]
Remark~6.7
\begin{equation}
h(x_3,x_4,x_1)=h(x_3,x_4,x_2)
\label{eq:67h}
\end{equation}
and
\begin{equation}
\begin{aligned}
\tau(x_3,x_4,x_1)&=\tau(x_3,x_4,x_2),\\
\tau(x_4,x_3,x_1)&=\tau(x_4,x_3,x_2);
\end{aligned}
\label{eq:67tau}
\end{equation}
moreover
\begin{equation}
\forall f,g\in\Bcl{S}_{00}\arii{4}\colon\qquad
\deltarelation[\set{0,1}]\neq\lset{\mathff{x}\in\set{0,1}^4}{f(\mathff{x})=g(\mathff{x})}.
\label{eq:67nondefinability}
\end{equation}

\item[Section~7]
Lemma~7.1,
\begin{equation}
\begin{aligned}
f(x_1,x_2,x_3)&\approx f(x_1, x_2,x_4),\\
f(x_2,x_1,x_3)&\approx f(x_2, x_1,x_4),\\
f(x_3,x_4,x_1)&\approx f(x_3, x_4,x_2),\\
f(x_4,x_3,x_1)&\approx f(x_4, x_3,x_2).
\label{eq:71}
\end{aligned}
\end{equation}
Theorem~7.6
\begin{equation}
\begin{aligned}
m(x_1,x_2,x_3)&\approx m(x_1,x_2,x_4),\\
m(x_2,x_1,x_3)&\approx m(x_2,x_1,x_4).
\label{eq:76}
\end{aligned}
\end{equation}
\item[Section~8]
Proposition~8.2
\begin{equation}
\begin{aligned}
f(x_1,x_2,x_3)&\approx f(x_1, x_2,x_4),\\
f(x_2,x_1,x_3)&\approx f(x_2, x_1,x_4),\\
f(x_3,x_4,x_1)&\approx f(x_3, x_4,x_2),\\
f(x_4,x_3,x_1)&\approx f(x_4, x_3,x_2).
\label{eq:82}
\end{aligned}
\end{equation}
\end{description}

We observe that the systems~\eqref{eq:71} and~\eqref{eq:82} are
syntactically identical, they only appear in different contexts where
the function symbol~$f$ is instantiated with two different concrete
functions, cf.~\cite{ABR2023}.

The solution sets of the systems~\eqref{eq:67h}-\eqref{eq:82} are
mainly computed and verified in the script
\fname{checking_systems_of_equations.py}; note, however that the code
for the verification of~\eqref{eq:67nondefinability} relies on
results arising from the script \fname{write_uacalc_files.py}.

\section*{List of files}
We now give a brief overview of the files in the data set, before
focusing on the content of
\fname{checking_systems_of_equations.py} in a little more detail.

\begin{center}
\begin{longtable}{@{}>{\footnotesize}p{0.4\linewidth}@{\;}p{0.595\linewidth}@{}}
\fname{checking_systems_of_equations.py}&
  python script verifying the definability of~$\deltarelation$ from the
  systems~\eqref{eq:67h}--\eqref{eq:82};
  outputs \fname{check_of_systems_of_equations.txt};
  the code partially depends on
  \fname{F4_over_S00.txt}.\\
\fname{check_of_systems_of_equations.txt}&
  output log of running the script
  \fname{checking_systems_of_equations.py}.\\
\fname{write_uacalc_files.py}&
  python script writing source files (\fname{*.alg})
  for the universal algebra calculator~\cite{UACalc};
  outputs \fname{output_write_uacalc_files.txt};
  results in the files
  \fname{aP.alg},
  \fname{AP.alg},
  \fname{L2.alg},
  \fname{S00.alg},
  \fname{S10.alg},
  \fname{SL.alg}.\par
  The script mainly defines functions for the generators of these
  clones according to the literature (referenced in the code) and then
  outputs the value tables of these functions in a format\footnotemark\
  suitable to be read by~\cite{UACalc}.\\
\fname{output_write_uacalc_files.txt}&
  output log of running the script
  \fname{write_uacalc_files.py}\\
\fname{aP.alg},
\fname{AP.alg},
\fname{L2.alg},
\fname{SL.alg},\quad
\fname{S00.alg},
\fname{S10.alg}&
  \addtocounter{footnote}{-1}%
  input files\footnote{The format of \fname{.alg}-files is briefly
  explained in the final section of this document.} for the universal
  algebra calculator~\cite{UACalc}, representing algebras the clone of
  term operations of which equals $\aP, \AP, \Ltwo, \SL$ appearing
  in~\cite[Section~7]{ABR2023} and~$\Bcl{S}_{00}$ and~$\Bcl{S}_{10}$
  from~\cite[Section~6]{ABR2023}, respectively;
  these have been written by running
  \fname{write_uacalc_files.py}.\\
\fname{F4_over_S00.csv},
\fname{F4_over_S10.csv}&
  result of computing in UACalc~\cite{UACalc} the free algebra on four
  generators (using all coordinates, no decomposition, no thinning)
  over the algebra represented by \fname{S00.alg} and \fname{S10.alg},
  respectively.\\
\fname{F4_over_S00.txt},
\fname{F4_over_S10.txt}&
  the same file as \fname{F4_over_S00.csv} and
  \fname{F4_over_S10.csv}, respectively, but after slight manual
  editing to enhance readability.\par
  Columns~3 to~18 of the table in
  \fname{F4_over_S00.txt} are used as part of the code of the function
  \funcname{check_implication_re_F4_S00_in_67()}
  in \fname{checking_systems_of_equations.py}.\\
\fname{systems4_eqn_add.pdf}&
  this documentation\\
\fname{systems4_eqn_add.tex}&
  \LaTeX\ source file to produce this documentation
\end{longtable}
\end{center}

\section*{Details regarding the script \fname{checking_systems_of_equations.py}}
The initial functions in \fname{checking_systems_of_equations.py}
implement generator functions as explained in~\cite{ABR2023} or as presented in the
literature referenced in the comments of
\fname{checking_systems_of_equations.py}.
This is rather self-explanatory given the comments. We briefly explain
the remaining functions:

\begin{center}
\begin{longtable}{@{}>{\footnotesize}p{0.4\linewidth}@{\;}p{0.595\linewidth}@{}}
\funcname{get_Deltarelation(k)}&
computes a sorted list containing the quadruples
in~$\deltarelation[{\set{0,\dotsc,k-1}}]$ where $k\in\N$.\\
\funcname{get_solution_set_71_82(f)}&
computes a sorted list containing the solutions of the systems~\eqref{eq:71}
(and~\eqref{eq:82}, respectively); the parameter is the ternary operation that
instantiates the symbol~$f$ in the systems~\eqref{eq:71}
and~\eqref{eq:82}.\\
\funcname{get_solution_set_76(f)}&
computes a sorted list containing the solutions of the system~\eqref{eq:76};
the parameter is the ternary operation that
instantiates the symbol~$f$ in the system.\\
\funcname{get_solution_set_67h(f)}&
computes a sorted list containing the solutions of the
system~\eqref{eq:67h} over $\set{0,1}$;
the parameter is the ternary Boolean function that
instantiates the symbol~$h$ in the system.\\
\funcname{get_solution_set_67t(f)}&
computes a sorted list containing the solutions of the
system~\eqref{eq:67tau} over $\set{0,1}$;
the parameter is the ternary Boolean function that
instantiates the symbol~$\tau$ in the system.\\
\funcname{check_solution_set_equals_delta(sol,k)}&
checks whether the solution set given as an ordered list of quadruples
over $\set{0,\dotsc,k-1}$ via the parameter \funcname{sol} is identical to
$\deltarelation[{\set{0,\dotsc,k-1}}]$.\\
\funcname{aux_fg_agree_on_delta(f,g)}&
an auxiliary function checking if two quaternary Boolean functions
$f,g\colon\set{0,1}^4\to\set{0,1}$, represented by their list of
$16$~values on
\resizebox{\linewidth}{!}{$\{(0,0,0,0),(0,0,0,1),(0,0,1,0),(0,0,1,1),\dotsc,(1,1,1,1)\}$}
satisfy $f\mathopen\restriction_{\deltarelation[\set{0,1}]}
       = g\mathopen\restriction_{\deltarelation[\set{0,1}]}.$
This function is used in
\funcname{check_implication_re_F4_S00_in_67()}.\\
\funcname{aux_fg_agree_somewhere_outside_delta(f,g)}&
an auxiliary function checking if two quaternary Boolean functions
$f,g\colon\set{0,1}^4\to\set{0,1}$, represented by their list of
$16$~values on
\resizebox{\linewidth}{!}{$\{(0,0,0,0),(0,0,0,1),(0,0,1,0),(0,0,1,1),\dotsc,(1,1,1,1)\}$}
satisfy
$\begin{aligned}[t]
         f(0,1,0,1)&= g(0,1,0,1)\lor{}\\
         f(0,1,1,0)&= g(0,1,1,0)\lor{}\\
         f(1,0,0,1)&= g(1,0,0,1)\lor{}\\
         f(1,0,1,0)&= g(1,0,1,0).
\end{aligned}$
\par
This function is used in
\funcname{check_implication_re_F4_S00_in_67()}.\\
\funcname{check_implication_re_F4_S00_in_67()}&
a function checking the truth of the universally quantified
inequality~\eqref{eq:67nondefinability} by verifying the following
universal implication
\resizebox{\linewidth}{!}{${\forall f,g\in\Bcl{S}_{00}\arii{4}\colon}
\begin{aligned}[t]
\deltarelation[\set{0,1}]&\subs\lset{\mathff{x}\in\set{0,1}^4}{f(\mathff{x})=g(\mathff{x})}\\
\Rightarrow
\deltarelation[\set{0,1}]&\subsetneq\lset{\mathff{x}\in\set{0,1}^4}{f(\mathff{x})=g(\mathff{x})}.
\end{aligned}$}
For this check the algorithm iterates over all pairs
$f,g\in\Bcl{S}_{00}\arii{4}$, finds those where the inclusion
$\deltarelation[\set{0,1}]\subs\lset{\mathff{x}\in\set{0,1}^4}{f(\mathff{x})=g(\mathff{x})}$
holds (via \funcname{aux_fg_agree_on_delta(f,g)}), and then checks
(via \funcname{aux_fg_agree_somewhere_outside_delta(f,g)})
that each time this happens the proper inclusion
$\deltarelation[\set{0,1}]\subsetneq\lset{\mathff{x}\in\set{0,1}^4}{f(\mathff{x})=g(\mathff{x})}$
holds, as well. When this is true, we either have proper inclusion, or
no inclusion at all, hence never equality, as claimed in~\eqref{eq:67nondefinability}.
\par
We remark that the iteration over all
$f,g\in\Bcl{S}_{00}\arii{4}$ is achieved by iterating over the rows in
the hard-coded list \funcname{F4}, which contains the functions in the
free four-generated algebra as taken from \fname{F4_over_S00.txt}.\\
remaining code&
uses the previously discussed functions to answer the questions that
can be read from the log file
\fname{check_of_systems_of_equations.txt}.
\end{longtable}
\end{center}

\section*{Format description of \fname{.alg}-files}
This section contains a short explanation of the format used in
\fname{.alg}-input files for the universal algebra
calculator~\cite{UACalc}.
A finite algebra $\alg{A}$ with $n\geq 1$ elements is represented in
UACalc by the standard carrier set $n= \set{0,1,\dotsc, n-1}$.
An \fname{.alg}-file contains, line by line, the following integer
numbers.
\begin{itemize}
\item The first line contains the value~$n$, the cardinality of the
      algebra.
\item For each fundamental operation~$f$ of~$\alg{A}$, say with
      $k\geq 0$ arguments, the following lines are included:
      \begin{itemize}
      \item a line with the value~$k$
      \item $n^k$ lines with the values of~$f$ in the following order:
      \bgroup\small
      \begin{align*}
            f&(0,0,0,\dotsc,0)\\
            f&(1,0,0,\dotsc,0)\\\vdots\\
            f&(n-1,0,0,\dotsc,0)\\
            f&(0,1,0,\dotsc,0)\\
            f&(1,1,0,\dotsc,0)\\\vdots\\
            f&(n-1,1,0,\dotsc,0)\\
            f&(0,2,0,\dotsc,0)\\\vdots\\
            f&(0,n-1,0,\dotsc,0)\\\vdots\\
            f&(n-1,n-1,0\dotsc,0)\\
            f&(0,0,1,\dotsc,0)\\&\ddots\\
            f&(n-1,n-1,\dotsc,n-1),
      \end{align*}
      \egroup
      that is to say, the first argument changes fastest, the last
      argument changes slowest.
      \end{itemize}
\end{itemize}
\begin{example}
The left-zero semigroup on~$\set{0,1,2}$, that is,
$\algwops{\set{0,1,2}}{f}$ where~$f$ is the
binary operation $f\colon\set{0,1,2}^2\to \set{0,1,2}$ given as
$f(x,y)\defeq x$ for each $x,y\in\set{0,1,2}$,
having the operation table
\[\begin{array}{c|ccc}
x\backslash y& 0&1&2\\\hline
0&0&0&0\\
1&1&1&1\\
2&2&2&2\rlap{\;,}
\end{array}\]
would be stored in \fname{.alg}-format as follows:
\bgroup\small
\begin{verbatim}
3
2
0
1
2
0
1
2
0
1
2
\end{verbatim}
\egroup
\end{example}

\begin{thebibliography}{1}

\bibitem{ABR2023}
Erhard Aichinger, Mike Behrisch, and Bernardo Rossi.
\newblock On when the union of two algebraic sets is algebraic.
\newblock {\em {\tt arXiv:\arxivid\ [math.RA]}}:1--50, September 2023.
\newblock \doi{10.48550/arXiv.2309.00478}

\bibitem{DanMyaRem10}
\`Evelina~Yur'evna Daniyarova, Alexei~Georgievich Myasnikov, and
  Vladimir~Nikanorovich Remeslennikov.
\newblock Algebraic geometry over algebraic structures. {IV}. {E}quational
  domains and codomains.
\newblock {\em Algebra i Logika}, 49(6):715--756, 844, 847, 2010.
\newblock Translation in \emph{Algebra and Logic}, 49(6):483--508, 2011.
\newblock \doi{10.1007/s10469-011-9112-2}

\bibitem{UACalc}
Ralph Freese, Emil Kiss, and Matthew Valeriote
\newblock Universal {A}lgebra {C}alculator, 2022.
\newblock Available on-line from {\url{http://www.uacalc.org}}.

\bibitem{Pin17a}
Aleksandr~Georgievich Pinus.
\newblock Algebraically equivalent clones.
\newblock {\em Algebra i Logika}, 55(6):760--768, 2016.
\newblock Translation in \emph{Algebra and Logic}, 55(6):501--506, 2017.
\newblock \doi{10.1007/s10469-017-9420-2}

\end{thebibliography}

\end{document}
