# Diagnosis in Tennis Serving Technique
## 4 An Algebraic Model for RBES  
In this section, we will see how we can implement an expert system based on Boolean propositional logic in a computer algebra system.  
Let us consider an expert system based on Boolean propositional logic with propositions \(X_{1}\ldots X_{m}\). Each formula in \(\mathcal{C}\) can be represented as a Boolean polynomial (see Definition 5). This representation makes use of the ideal \(I\) in \(\mathbb{Z}_{2}[x_{1},...,x_{m}]\):  
\[I=\langle x_{1}^{2}-x_{1},...,x_{m}^{2}-x_{m}\rangle\]  
**Notation 1** (Nf).: _Let \(NF(pol,I)\) denote the 'normal form' of polynomial pol modulo ideal \(I\)._  
**Definition 5** (function \(\varphi\)).: _We define recursively the function \(\varphi:\mathcal{C}\longrightarrow\mathbb{Z}_{2}[x_{1},...,x_{m}]\) as follows:_  
* _If_ \(A\equiv X_{i}\)_, then_ \(\varphi(A)=x_{i}\)__
* _If_ \(A\equiv-B\) _where_ \(B\in\mathcal{C}\)_, then_ \(\varphi(A)=NF(1+\varphi(B),I)\)__
* _If_ \(A\equiv B\wedge C\) _where_ \(B,C\in\mathcal{C}\)_, then_ \(\varphi(A)=NF(\varphi(B)\cdot\varphi(C),I)\)__
* _If_ \(A\equiv B\lor C\) _where_ \(B,C\in\mathcal{C}\)_, then_ \(\varphi(A)=NF(\varphi(B)+\varphi(C)+\varphi(B)\cdot\varphi(C),I)\)__
* _If_ \(A\equiv B\to C\) _where_ \(B,C\in\mathcal{C}\)_, then_ \(\varphi(A)=NF(1+\varphi(B)+\varphi(B)\cdot\varphi(C),I)\)_._  
As may be seen in the previous definition, for any formula \(A\), \(\varphi(A)\) is a polynomial in \(\mathbb{Z}_{2}[x_{1},...,x_{m}]\) whose variables are never to a power greater than \(1\) (continuously computing the reduction modulo ideal \(I\) is equivalent to work in the residue class ring \(\mathbb{Z}_{2}[x_{1},...,x_{m}]/I\)). Besides, the total degree of the polynomial may be, at most, equal to the number of variables.  
Once described how Boolean formulae are represented by polynomials, we show, by Theorem 1, how the problem of determining if a formula is tautological consequence of others can be translated into an algebraic problem [5]. Previous works not providing a residue class ring as a model for the logic and not considering the extension to RBES are [6,7] (Boolean case) and [8,9] (many-valued case). A detailed survey can be found in [10]. There are recent developments in this line of research such as [11,12].  
**Theorem 1**.: _Let \(A_{1},...,A_{n},B\in\mathcal{C}\). The following holds:_  
1. \(\{A_{1},...,A_{n}\}\models B\Leftrightarrow\varphi(\
eg B)\in\langle \varphi(\
eg A_{1}),...,\varphi(\
eg A_{n})\rangle+I\)__
2. \(\{A_{1},...,A_{n}\}\) _is consistent_ \(\Leftrightarrow 1\
ot\in\langle\varphi(\
eg A_{1}),...,\varphi(\
eg A_{n})\rangle+I\)__Theorem 1 is important since the algebraic problems involved in this theorem may be solved making use of Groebner bases [13; 14; 15]. On the ground of this, many expert systems have been developed in different fields [16; 17; 18; 19; 20; 21].  
Indeed, the question of determining whether a RBES with knowledge-base \(\{R_{1},...,R_{n^{\prime}}\}\) infers the formula \(B\) when its input is the set of facts \(\{F_{1},...,F_{n}\}\) may be solved by checking whether the following holds:  
\[NF(\varphi(\
eg B),I+\left\langle\varphi(\
eg F_{1}),...,\varphi(\
eg F_{n}),\varphi(\
eg R_{1}),...,\varphi(\
eg R_{n})\right\rangle)=0\]  
We can simplify the previous expression through the definition of the following ideals:  
\[J=\left\langle\varphi(\
eg F_{1}),...,\varphi(\
eg F_{n})\right\rangle\]  
\[K=\left\langle\varphi(\
eg R_{1}),...,\varphi(\
eg R_{n^{\prime}})\right\rangle\]  
In this way, the expression above results into:  
\[NF(\varphi(\
eg B),I+J+K)=0\]  
Similarly, the consistency of such RBES for the set of facts \(\{F_{1},...,F_{n}\}\) can be decided using Groebner bases, as it is equivalent to:  
\[GB(I+\left\langle\varphi(\
eg F_{1}),...,\varphi(\
eg F_{n}),\varphi(\
eg R_ {1}),...,\varphi(\
eg R_{n})\right\rangle)\
eq\left\langle 1\right\rangle\]  
what can be written:  
\[GB(I+J+K)\
eq\left\langle 1\right\rangle\]