% !TEX root = main.tex
% !TEX spellcheck = en-US

\section{Non-malleability of $\sonicprotfs$}
\label{sec:sonic}

\markulfdone{22.04}{I prefer the notation $Pr[\chi \gets \FF_q; \chi' \gets \adv( ...): \chi=\chi']$ as one can start reading at the left. But I will let that one go and will admit that it's a question of taste and it might be an aquired taste. }

\subsection{Preliminaries}
\begin{definition}[$(q_1, q_2)\mhyph\ldlog$ assumption]\label{def:ldlog}
  Let $\adv$ be a $\ppt$ adversary that gets as input
  $\gone{\chi^{-q_1}, \ldots, 1, \ldots, \chi^{q_1}}, \gtwo{\chi^{-q_2},
    \ldots, 1, \ldots, \chi^{q_2}}$, for some randomly picked
  $\chi \in \FF_p$, the assumption requires that $\adv$ cannot compute $\chi$. That is
	\[
    \condprob{\chi = \adv(\gone{\chi^{-q_1}, \ldots, 1, \ldots,
        \chi^{q_1}}, \gtwo{\chi^{-q_2}, \ldots, 1, \ldots, \chi^{q_2}
      })}{\chi \sample \FF_p} \leq \negl.
	\]
\end{definition}

\begin{definition}[$(q_1, q_2)\mhyph\uldlog$ assumption]\label{def:uldlog}
	Let $\adv$ be a $\ppt$ adversary that gets oracle access to $\initU$ with internal algorithms $(\kgen_{\ldlog}, \upd_{\ldlog}, \verifyCRS)$, where $\kgen_{\ldlog}$ and $\upd_{\ldlog}$ are defined as follows:
	\begin{itemize}
		\item $\kgen_\ldlog(\secpar)$ samples $\chi \sample \FF_p$ and defines
		$\Ch:=(\gone{\chi^{-q_1}, \ldots, 1, \chi, \ldots,
			\chi^{q_1}}, \gtwo{\chi^{-q_2}, \ldots, 1, \chi, \ldots, \chi^{q_2}
		})$.
		\item $\upd_\ldlog(\Ch, \{\rho_j \}_{j=1}^n)$
		parses $\Ch$ as $\left( \gone{\smallset{A_i}_{i = -q_1}^{q_1}},
		\gtwo{\smallset{B_i}_{i = -q_2}^{q_2}} \right)$, samples
		$\widetilde{\chi} \sample \FF_p$, and defines
		$\widetilde{\Ch} :=
		\left( \gone{\smallset{\widetilde{\chi}^i A_i}_{i = -q_1}^{q_1}},
		\gtwo{\smallset{\widetilde{\chi}^i B_i}_{i = -q_2}^{q_2}} \right)$.
	\end{itemize}
	Then
	\[
	\prob{\bar{\chi} \gets \adv^{\initU}(\secpar)} \leq \negl,
	\]
	where $\left( \gone{\smallset{\bar{\chi}^i}_{i = -q_1}^{q_1}},
	\gtwo{\smallset{\bar{\chi}^i}_{i = -q_2}^{q_2}} \right)$ is the finalized challenge.
\end{definition}

\subsection{\sonic{} Protocol Rolled-out}
In this section we present $\sonic$'s constraint system and algorithms. Reader
familiar with them may jump directly to the next section.

 \begin{figure}[h!]
 \centering
 	\begin{pcvstack}[center,boxed]
 		\begin{pchstack}
 			\procedure{$\kgen(\secparam, \maxdeg)$} {
 				\alpha, \chi \sample \FF^2_p \\ [\myskip]
 				\pcreturn \gone{\smallset{\chi^i}_{i = -\multconstr}^{\multconstr},
           \smallset{\alpha \chi^i}_{i = -\multconstr, i \neq
             0}^{\multconstr}},\\
         \pcind \gtwo{\smallset{\chi^i, \alpha \chi^i}_{i =
             -\multconstr}^{\multconstr}}, \gtar{\alpha}\\
 				\hphantom{\hspace*{5.5cm}}
 		}

 			\pchspace

 			\procedure{$\com(\srs, \maxconst, \p{f}(X))$} {
 				\p{c}(X) \gets \alpha \cdot X^{\dconst - \maxconst} \p{f}(X) \\ [\myskip]
 				\pcreturn \gone{c} = \gone{\p{c}(\chi)}\\ [\myskip]
 				\hphantom{\pcind \pcif \sum_{i = 1}^{\abs{\vec{z}}} r_i \cdot
           \gone{\sum_{j = 1}^{t_j} \gamma_i^{j - 1} c_{i, j} - \sum_{j = 1}^{t_j}
             s_{i, j}} \bullet \gtwo{1} + } }
 		\end{pchstack}
 		% \pcvspace

 		\begin{pchstack}
 			\procedure{$\open(\srs, z, s, f(X))$}
 			{
 				\p{o}(X) \gets \frac{\p{f}(X) - \p{f}(z)}{X - z}\\ [\myskip]
 				\pcreturn \gone{\p{o}(\chi)}\\ [\myskip]
 				\hphantom{\hspace*{5.5cm}}
 			}

 			\pchspace

 			\procedure{$\verify(\srs, \maxconst, \gone{c}, z, s, \gone{\p{o}(\chi)})$}
       {
         \pcif \gone{\p{o}(\chi)} \bullet \gtwo{\alpha \chi} + \gone{s - z
         \p{o}(\chi)} \bullet \gtwo{\alpha} = \\ [\myskip] \pcind \gone{c}
         \bullet \gtwo{\chi^{- \dconst + \maxconst}} \pcthen  \pcreturn 1\\
         [\myskip]
         \rlap{\pcelse \pcreturn 0.} \hphantom{\pcind \pcif \sum_{i =
             1}^{\abs{\vec{z}}} r_i \cdot \gone{\sum_{j = 1}^{t_j} \gamma_i^{j -
               1} c_{i, j} - \sum{j = 1}^{t_j} s_{i, j}} \bullet \gtwo{1} + } }
 		\end{pchstack}
 	\end{pcvstack}

 	\caption{$\PCOMs$ polynomial commitment scheme.}
 	\label{fig:pcoms}
 \end{figure}

\oursubsub{The Constraint System}
\label{sec:sonic_constraint_system}
\cref{fig:pcoms} presents a variant of KZG~\cite{AC:KatZavGol10} polynomial commitment schemes used in \sonic{}. \sonic's system of constraints composes of three $\multconstr$-long vectors
$\va, \vb, \vc$ which corresponds to left and right inputs to multiplication
gates and their outputs. It hence holds $\va \cdot \vb = \vc$.

There is also $\linconstr$ linear constraints of the form
\[
  \va \vec{u_q} + \vb \vec{v_q} + \vc \vec{w_q} = k_q,
\]
where $\vec{u_q}, \vec{v_q}, \vec{w_q}$ are vectors for the $q$-th linear
constraint with instance value $k_q \in \FF_p$. Furthermore define polynomials
\begin{equation}
  \begin{split}
    \p{u_i}(Y) & = \sum_{q = 1}^\linconstr Y^{q + \multconstr} u_{q, i}\,,\\
    \p{v_i}(Y) & = \sum_{q = 1}^\linconstr Y^{q + \multconstr} v_{q, i}\,,\\
  \end{split}
  \qquad
  \begin{split}
    \p{w_i}(Y) & = -Y^i - Y^{-i} + \sum_{q = 1}^\linconstr Y^{q +
      \multconstr} w_{q, i}\,,\\
    \p{k}(Y) & = \sum_{q = 1}^\linconstr Y^{q + \multconstr} k_{q}.
  \end{split}
\end{equation}

$\sonic$ constraint system requires that
\begin{align}
  \label{eq:sonic_constraint}
  \vec{a}^\top \cdot \vec{\p{u}} (Y) + \vec{b}^\top \cdot \vec{\p{v}} (Y) +
  \vec{c}^\top \cdot \vec{\p{w}} (Y) + \sum_{i = 1}^{\multconstr} a_i b_i (Y^i +
  Y^{-i}) - \p{k} (Y) = 0.
\end{align}

In \sonic{} we will use commitments to the following polynomials.
\begin{align*}
  \pr(X, Y) & = \sum_{i = 1}^{\multconstr} \left(a_i X^i Y^i + b_i X^{-i} Y^{-i}
              + c_i X^{-i - \multconstr} Y^{-i - \multconstr}\right) \\
  \p{s}(X, Y) & = \sum_{i = 1}^{\multconstr} \left( u_i (Y) X^{-i} +
                v_i(Y) X^i + w_i(Y) X^{i + \multconstr}\right)\\
  \pt(X, Y) & = \pr(X, 1) (\pr(X, Y) + \p{s}(X, Y)) - \p{k}(Y)\,.
\end{align*}

Polynomials $\p{r} (X, Y), \p{s} (X, Y), \p{t} (X, Y)$ are designed such that
$\p{t} (0, Y) = \vec{a}^\top \cdot \vec{\p{u}} (Y) + \vec{b}^\top \cdot
\vec{\p{v}} (Y) + \vec{c}^\top \cdot \vec{\p{w}} (Y) + \sum_{i =
  1}^{\multconstr} a_i b_i (Y^i + Y^{-i}) - \p{k} (Y) $. That is, the prover is
asked to show that $\p{t} (0, Y) = 0$, cf.~\cref{eq:sonic_constraint}.

Furthermore, the commitment system in $\sonic$ is designed such that it is
infeasible for a $\ppt$ algorithm to commit to a polynomial with non-zero
constant term.

\oursubsub{Algorithms Rolled out}
\ourpar{$\sonic$ SRS generation $\kgen(\REL)$.} The SRS generating algorithm picks
randomly $\alpha, \chi \sample \FF_p$ and outputs
	\[
      \srs = \left( \gone{\smallset{\chi^i}_{i = -\dconst}^{\dconst},
          \smallset{\alpha \chi^i}_{i = -\dconst, i \neq 0}^{\dconst}},
        \gtwo{\smallset{\chi^i, \alpha \chi^i}_{i = - \dconst}^{\dconst}},
        \gtar{\alpha} \right)
	\]
\ourpar{$\sonic$ prover $\prover(\srs, \inp, \wit=\va, \vb, \vc)$.}
\begin{description}
\item[Message 1] The prover picks randomly randomizers
  $c_{\multconstr + 1}, c_{\multconstr + 2}, c_{\multconstr + 3}, c_{\multconstr
    + 4} \sample \FF_p$. Sets
  $\pr(X, Y) \gets \pr(X, Y) + \sum_{i = 1}^4 c_{\multconstr + i} X^{- 2
    \multconstr - i}$. Commits to $\pr(X, 1)$ and outputs
  $\gone{r} \gets \com(\srs, \multconstr, \pr(X, 1))$.  Then it computes challenge $y = \ro(\tzkproof[0..1])$.
\item[Message 2] $\prover$ commits to $\pt(X, y)$ and outputs
  $\gone{t} \gets \com(\srs, \dconst, \pt(X, y))$. Then it gets a challenge $z = \ro(\tzkproof[0..2])$.
\item[Message 3] The prover computes commitment openings. That is, it outputs
  \begin{align*}
    \gone{o_a} & = \open(\srs, z, \pr(z, 1), \pr(X, 1)) \\
    \gone{o_b} & = \open(\srs, y z, \pr(y z, 1), \pr(X, 1)) \\
    \gone{o_t} & = \open(\srs, z, \pt(z, y), \pt(X, y))
  \end{align*}
  along with evaluations $a' = \pr(z, 1), b' = \pr(y, z), t' = \pt(z, y)$.  Then it
  engages in the signature of correct computation playing the role of the
  helper, i.e.~it commits to $\p{s}(X, y)$ and sends the commitment $\gone{s}$, commitment opening
  \begin{align*}
    \gone{o_s} & = \open(\srs, z, \p{s}(z, y), \p{s}(X, y)), \\
  \end{align*} and $s'=\p{s}(z, y)$.
%
  Then
  it obtains a challenge $u = \ro(\tzkproof[0..3])$.
\item[Message 4] For the next message the prover computes
  $\gone{c} \gets \com(\srs, \dconst, \p{s}(u, Y))$ and
  computes commitments' openings
  \begin{align*}
    \gone{w} & = \open(\srs, u, \p{s}(u, y), \p{s}(X, y)), \\
    \gone{q_y} & = \open(\srs, y,\p{s}(u, y), \p{s}(u, Y)),
  \end{align*}
  and returns $\gone{w}, \gone{q_y}, s = \p{s}(u, y)$. Eventually the prover gets the last challenge
  $z' = \ro(\tzkproof[0..4])$.
\item[Message 5] For the final message, $\prover$ computes opening
  $\gone{q_{z'}} = \open(\srs, z', \p{s}(u, z'), \p{s}(u, X))$ and outputs $\gone{q_{z'}}$.
\end{description}

\ourpar{$\sonic$ verifier $\verifier(\srs, \inp, \zkproof)$.} The verifier
in \sonic{} runs as subroutines the verifier for the polynomial commitment. That
is it sets $t' = a'(b' + s') - \p{k}(y)$ and checks the following:
\begin{equation*}
  \begin{split}
    &\PCOMs.\verifier(\srs, \multconstr, \gone{r}, z, a', \gone{o_a}), \\
    &\PCOMs.\verifier(\srs, \multconstr, \gone{r}, y z, b', \gone{o_b}),\\
    &\PCOMs.\verifier(\srs, \dconst, \gone{t}, z, t', \gone{o_t}),\\
    &\PCOMs.\verifier(\srs, \dconst, \gone{s}, z, s', \gone{o_s}),\\
  \end{split}
  \qquad
  \begin{split}
    &\PCOMs.\verifier(\srs, \dconst, \gone{s}, u, s, \gone{w}),\\
    &\PCOMs.\verifier(\srs, \dconst, \gone{c}, y, s, \gone{q_y}),\\
    &\PCOMs.\verifier(\srs, \dconst, \gone{c}, z', \p{s}(u, z'), \gone{q_{z'}}),
  \end{split}
\end{equation*}
and accepts the proof iff all the checks holds. Note that the value
$\p{s}(u, z')$ that is recomputed by the verifier uses separate challenges $u$
and $z'$. This enables the batching of many proof and outsourcing of this
part of the proof to an untrusted helper.

\subsection{Unique Opening Property of $\PCOMs$}
\begin{lemma}
\label{lem:pcoms_unique_op}
$\PCOMs$ has the unique opening property in the AGM.
\end{lemma}
\begin{proof}
Let
$z \in \FF_p$ be the attribute the polynomial is evaluated at,
$\gone{c} \in \GRP$ be the commitment,
$s \in \FF_p$ the evaluation value, and
$o \in \GRP$ be the commitment opening.
We need to show that for every $\ppt$ adversary $\adv$ probability
\[
  \Pr \left[
    \begin{aligned}
      & \verify(\srs, \gone{c}, z, s, \gone{o}) = 1, \\
      & \verify(\srs, \gone{c}, z, \tilde{s}, \gone{\tilde{o}}) = 1
    \end{aligned}
    \,\left|\, \vphantom{\begin{aligned}
          & \verify(\srs, \gone{c}, z, s, \gone{o}),\\
          & \verify(\srs, \gone{c}, z, s, \gone{\tilde{o}}) \\
          &o \neq \tilde{o})
		\end{aligned}}
      \begin{aligned}
        %& \srs \gets \kgen(\secparam, \maxdeg), \\
        & (\gone{c}, z, s, \gone{o}, \gone{\tilde{o}}) \gets \adv^{\initU}(1^\secpar, \maxdeg)
      \end{aligned}
    \right.\right]
  % \leq \negl.
\]
is at most negligible.

As noted in \cite[Lemma 2.2]{EPRINT:GabWilCio19} it is enough to upper bound the
probability of the adversary succeeding against the ideal verifier, who verifies equality between polynomials.

For a polynomial $f$, its degree upper bound $\maxconst$, evaluation point $z$,
evaluation result $s$, and opening $\gone{o(X)}$ the ideal verifier checks that
\begin{equation}
  \alpha (X^{\dconst - \maxconst}f(X) \cdot X^{-\dconst + \maxconst} -  s) \equiv \alpha \cdot o(X) (X - z)\,,
\end{equation}
what is equivalent to
\begin{equation}
	f(X) -  s \equiv o(X) (X - z)\,.
	\label{eq:pcoms_idealised_check}
\end{equation}
Since $o(X)(X - z) \in \FF_p[X]$ then from the uniqueness of polynomial
composition, there is only one $o(X)$ that fulfills the equation above.
\qed
\end{proof}

\subsection{Unique Response Property}
The unique response property of $\sonicprotfs$ follows from the unique opening
property of the polynomial commitment scheme $\PCOMs$.
\begin{lemma}
\label{lem:sonicprot_ur}
If a polynomial commitment scheme $\PCOMs$ is evaluation binding with security loss $\epsbind (\secpar)$ and has unique openings property with security loss $\epsop(\secpar)$,\COMMENT{ and $(\dconst, \dconst)$-$\uldlog$ problem is $\epsuldlog (\secpar)$-hard,} then $\sonicprotfs$ is $\ur{2}$ against algebraic adversaries with security loss
  \[
    2 \cdot \epsbinding (\secpar) + \epsop (\secpar).
  \]
\end{lemma}

\begin{proof}
  Let $\adv$ be an algebraic adversary tasked to break the $\ur{2}$-ness of
  $\sonicprotfs$. We note that to show $\ur{2}$-ness is is enough to show that the first prover's message determines, along with the verifiers challenges, the rest of it.
  % This is done by game hops. In the games, the adversary outputs two proofs
  We denote by $\zkproof^0$ and $\zkproof^1$ the two proofs for the same statement the adversary outputs.
  To distinguish polynomials and commitments which an honest prover sends in the
  proof from the polynomials and commitments computed by the adversary we write the latter using indices $0$ and $1$ (two indices as we have two transcripts), e.g.~to describe the quotient polynomial provided by the adversary we write $\p{t}^0$ and   $\p{t}^1$ instead of $\p{t}$ as in the description of the protocol.

  We note that since the unique response property requires from $\zkproof^{0}$ and $\zkproof^{1}$ that the first place they possibly differ is the $3$-th prover's message, then the challenge $z$, that is picked by the adversary after the $2$-rd message is the same in both transcripts. This challenge determines the evaluation point of polynomials $\p{r}(X, 1), \p{t}(X, y)$ which commitments are already sent.

  In its third message, the prover provides evaluations of these polynomials along with their openings at $z$ or $yz$. Note that the adversary can output two accepting proofs that differ on their third message only if it  manages to break evaluation binding of one of the opening. Since the commitment scheme is evaluation binding with security loss $\epsbinding (\secpar)$, the adversary can make $\zkproof^{0}$ and $\zkproof^{1}$ differ on the third message with probability at most $\epsbinding (\secpar) $.

  Similarly, in its fourth message, the prover provides an evaluation at $u$ of polynomial $\p{s}(X, y)$, an evaluation at $y$ of $\p{s} (u, Y)$, and the corresponding openings. Note that the adversary can output two accepting proofs that differ on their fourth message only if it manages to break evaluation binding of one of the opening. Since the commitment scheme is evaluation binding with security loss $\epsbinding (\secpar)$, the adversary can make $\zkproof^{0}$ and $\zkproof^{1}$ differ on the fourth message with probability at most $\epsbinding (\secpar) $.

  Next, assume that the transcripts are the same up to the fourth message, but differ at the fifth. In that message, the adversary provides openings of the evaluations. Since the unique opening property, the adversary can open the valid evaluation of a polynomial to two different values with probability at most $\epsop (\secpar)$.%, which is upper-bounded by $\epsuldlog (\secpar)$.

  By the union bound, the adversary is able to break the unique response property with probability upper bounded by $2 \epsbinding (\secpar) + \epsop (\secpar)$.
\iffalse
  \michals{30.4}{Old proof starts here}

  \ncase{Game 0}
  \ngame{0} In this game, the adversary additionally wins if it provides two transcripts that match on all $5$ messages sent by the prover.
  In this game the adversary cannot win.

  \ngame{1} This game is identical to Game $\game{0}$ except that now the
  adversary additionally wins if it provides two transcripts that matches on the first four
  messages of the proof.

  \ncase{Game 0 to Game 1} We show that the probability that $\adv$
  wins in one game but does not in the other is negligible.  Observe that in
  after its $4$-th message, the adversary is given a challenge $z'$ and has to open
  commitment to $\p{s} (u, z')$. Hence, to be able to give two different
  openings in its $5$-th message, $\adv$ has to break the unique opening property of the
  KZG commitment scheme which happens with probability $\epsop (\secpar)$ tops.

  \ngame{2} This game is identical to Game $\game{1}$ except that now the
  adversary additionally wins if it provides two transcripts that matches on the
  first three messages of the proof.

  \ncase{Game 2 to Game 3} In its $4$-th message the adversary computes evaluation
  $s = \p{s} (u, y)$ and the corresponding openings $\gone{w}, \gone{q_y}$. The adversary
  cannot provide two different evaluations for the committed polynomials, since that would
  require breaking the evaluation binding property, which happens (by the union bound)
  with probability at most $2 \cdot \epsbind (\secpar)$. Also, the adversary cannot provide two
  different yet valid opening except probability $2 \cdot \epsop (\secpar)$

  Hence, the probability that adversary wins in one game but does not in the
  other is upper-bounded by $2 \cdot (\epsbind (\secpar) + \epsop (\secpar))$

  \ngame{4} This game is identical to Game $\game{3}$ except that now the
  adversary additionally wins if it provides two transcripts that match on the
  first two messages of the proof.

  \ncase{Game 3 to Game 4} In its $3$-rd message the adversary computes $4$ polynomial
  evaluations and their openings. It also sends commitment to $\p{s} (X, y)$ which is a
  signature of correct computation.

  Probability that the adversary provides different evaluations or polynomial openings is
  upper bounded by $4 \cdot (\epsop (\secpar) + \epsbind (\secpar))$. Since the polynomial
  commitment scheme is deterministic, if commitment to $\p{s^0} (X, y)$ does not equal
  commitment to $\p{s^1} (X, y)$, then at least one of these values has been computed
  incorrectly. Probability that the adversary outputs an accepting proof, where signature
  of correct computation has been computed incorrectly is upper-bounded by $\epss
  (\secpar) + \epsdlog (\secpar)$, cf.~\cref{lem:plonkprot_ur}.

  \ncase{Game 5}  This game is identical to Game $\game{4}$ except that now the
  adversary additionally wins if it provides two transcripts that match on the
  first messages of the proof.

  \ncase{Game 4 to Game 5} In its second message the adversary commits to polynomial
  $\p{t} (X, y)$. Since the commitment scheme is deterministic, probability that adversary
  outputs accepting proofs where commitment to $\p{t^0} (X, y)$ does not equal commitment
  to $\p{t^1} (X)$ is upper-bounded by $\epss (\secpar) + \epsdlog (\secpar)$, cf.~\cref{lem:plonkprot_ur}.

  \ncase{Conclusion} Taking all the games together, the probability that $\adv$ wins
  in Game 5 is upper-bounded by
  \[
    3 \cdot \epsop (\secpar) + 2 \cdot (\epsbind (\secpar) + \epss (\secpar) +
    \epsdlog (\secpar)).
  \]
  \fi
  \qed
\end{proof}

\subsection{Rewinding-Based Knowledge Soundness}
\begin{lemma}
	\label{lem:sonicprot_ss}
  $\sonicprotfs$ is $(2, \noofc + 1)$-rewinding-based knowledge sound against algebraic adversaries who make up to $q$ random oracle queries with security loss
  \[
    \epscss(\secpar,\accProb, q) \leq \left(1 - \frac{\accProb - (q + 1) \left( \frac{\noofc}{p}\right)}{1 - \frac{\noofc}{p}}\right) + (\noofc + 1) \cdot \epsuldlog (\secpar)\,,
  \]
	Here $\accProb$ is a probability that the adversary outputs an accepting proof, and $\epsuldlog(\secpar)$ is the security of $(\maxdeg, \maxdeg)$-$\uldlog$ assumption.
\end{lemma}

% 	$\sonicprot$ is $(2, \noofc + 1)$-computational special sound with security loss $(\epst (\accProb, \secpar), \epss(\secpar))$ against
% 	algebraic adversaries, where
%   \[
%     \epst(\accProb, \secpar) \leq \frac{\accProb - (q + 1) \epsid (\secpar)}{1 - \epsid (\secpar)}\,,
%   \]
%   and
% 	\[
% 	  \epss(\secpar) \leq \epsid(\secpar) + \epsldlog(\secpar) \,.
% 	\]
% 	Here $\accProb$ is a probability that the adversary outputs an accepting proof, $q$ is the upper bound for a number of random oracle queries the adversary makes, $\epsid(\secpar)$ is a soundness error of the idealized verifier, and $\epsldlog(\secpar)$ is security of $(\dconst, \dconst)$-$\ldlog$ assumption.
% \end{lemma}

Let $\adv^{\ro, \initU}(\secparam; r)$ be the adversary who outputs $(\inp, \zkproof)$ such that $\sonicprotfs.\verifier$ accepts the proof. Let $\tdv$ be the tree-building algorithm of \cref{lem:attema} that outputs a tree $\tree$, and let $\extcss$ be an extractor that given the tree output by $\tdv$ reveals the witness for $\inp$. The main idea of the proof is to show that an adversary who breaks rewinding-based knowledge soundness can be used to break a $\uldlog$-problem instance. The proof goes by game hops. Note that since the tree branches after $\adv$'s $2$-nd message, the instance $\inp$, commitments $\gone{\p{r} (\chi, 1), \p{t} (\chi, y)}$, and challenge $y$ are the same in all the transcripts. Also, the tree branches after the second adversary's message where the challenge $z$ is presented, thus tree $\tree$ is built using different values of $z$.	We consider the following games.

  \ncase{Game 0} %
  In this game, the adversary wins if it outputs a valid instance--proof pair $(\inp, \zkproof)$, and the extractor $\extcss$ does not manage to output a witness $\wit$ such that $\REL (\inp, \wit)$ holds.

  \ncase{Game 1} %
  In this game, the environment aborts the game if the tree building algorithm $\tdv$ fails in building a tree of accepting transcripts $\tree$.

  \ncase{Game 0 to Game 1} %
  By \cref{lem:attema} probability that Game 1 is aborted, while Game 0 is not, is, at most
  \[
    1 - \frac{\accProb - (q + 1) \left( \frac{\noofc}{p} \right)} {1 - \frac{\noofc }{p}} \,.
\]

  \ncase{Game 2} %
  In this game the environment additionally aborts if at least one of its proofs in $\tree$ is not accepting by an ideal verifier.

  \ncase{Game 1 to Game 2} %
  As usual, we show a reduction that breaks an instance of a $\uldlog$ assumption when Game 2 is aborted, while Game 1 is not.

  Let $\rdvuldlog$ be a reduction that gets as input an $(\maxdeg, \maxdeg)$-$\uldlog$ instance $\gone{\chi^{-\maxdeg}, \ldots, 1, \ldots, \chi^{\maxdeg}}, \gtwo{\chi^{-\maxdeg}, \ldots, 1, \ldots, \chi^{\maxdeg}}$. Then it can update the instance to another one $\gone{\chi'^{-\maxdeg}, \ldots, 1, \ldots, \chi'^{\maxdeg}}, \gtwo{\chi'^{-\maxdeg}, \ldots, 1, \ldots, \chi'^{\maxdeg}}$. Eventually, the reduction outputs $\chi'$.
	%
	The reduction $\rdvuldlog$ proceeds as follows.
	First, it builds $\adv$'s SRS $\srs$ using the input $\uldlog$ instance. Then it processes the adversary's update query by adding it to the list $\Qsrs$ and passing it to its own update oracle getting instance $\gone{\chi'^{-\maxdeg}, \ldots, 1, \ldots, \chi'^{\maxdeg}}, \gtwo{\chi'^{-\maxdeg}, \ldots, 1, \ldots, \chi'^{\maxdeg}}$. The updated SRS $\srs'$ is then computed and given to $\adv$. $\rdvuldlog$ also takes care of the random oracle queries made by $\adv$. It picks their answers honestly and writes them in $\Qro$. The reduction then starts $\tdv(\srs, \adv, r, \Qro, \Qsrs)$.

  Let $(1, \tree)$ be the output returned by $\tdv$. Let $\inp$ be a relation proven in $\tree$.  Consider a transcript $\zkproof \in \tree$ such that $\vereq_{\inp, \zkproof}(X) \neq 0$, but $\vereq_{\inp, \zkproof}(\chi') = 0$. Since $\adv$ is algebraic, all group elements included in $\tree$ are extended by their representation as a combination of the input $\GRP_1$-elements. Hence, all coefficients of the verification equation polynomial $\vereq_{\inp, \zkproof}(X)$ are known.
  Eventually, the reduction finds $\vereq_{\inp, \zkproof}(X)$ zero points and returns $\chi'$ which is one of them.

  Hence, the probability that the adversary wins in Game 2 but does not win in Game 1 is upper-bounded by $(\noofc + 1) \cdot \epsuldlog (\secpar)$.

  \ncase{Conclusion}
  Note that the adversary can win in Game 2 only if $\tdv$ manages to produce a tree of accepting transcript $\tree$, such that each of the transcripts in $\tree$ is accepting by an ideal verifier. Note that since $\tdv$ produces $(\noofc + 1)$ accepting transcripts for different challenges $z$, it obtains the same number of different evaluations of polynomial $\p{t} (z, y)$ what allows to extract the witness, cf.~\cite{CCS:MBKM19}.

  Hence, the probability that the adversary wins in Game 0 is upper-bounded by
  \[
    \epscss(\secpar,\accProb, q) \leq \left(1 - \frac{\accProb - (q + 1) \left( \frac{\noofc}{p} \right)}{1 - \frac{\noofc}{p}}\right) + (\noofc + 1) \cdot\epsuldlog (\secpar)\,.
  \]

\subsection{Trapdoor-Less Zero-Knowledge of Sonic}
\begin{lemma}
\label{lem:sonic_hvzk}
$\sonicprotfs$ is 2-programmable trapdoor-less zero-knowledge.
\end{lemma}
\begin{proof}
  The simulator proceeds as follows.
  \begin{enumerate}
  \item Pick randomly vectors $\vec{a}$, $\vec{b}$ and set
    \begin{equation}
      \label{eq:ab_eq_c}
      \vec{c} = \vec{a} \cdot \vec{b}.
    \end{equation}
  \item Pick randomizers $c_{\multconstr + 1}, \ldots, c_{\multconstr + 4}$,
    honestly compute polynomials $\p{r}(X, Y), \p{r'}(X, Y), \p{s}(X, Y)$ and
    pick randomly challenges $y$, $z$.
  \item Output commitment $\gone{r} \gets \com(\srs, \multconstr, \p{r} (X,
    1))$ and challenge $y$.
  \item Compute
    \begin{align*}
      & a' = \p{r}(z, 1),\\
      & b' = \p{r}(z, y),\\
      & s' = \p{s}(z, y).
    \end{align*}
  \item Pick polynomial $\p{t}(X, Y)$ such that
    \begin{align*}
      & \p{t} (X, y) = \p{r} (X, 1) (\p{r}(X, y) + \p{s} (X, y)) - \p{k} (Y)\\
      & \p{t} (0, y) = 0
    \end{align*}
  \item Output commitment $\gone{t} = \com (\srs, \dconst, \p{t} (X, y))$ and
    challenge $z$.
  \item Continue following the protocol.
  \end{enumerate}

  We note that the simulation is perfect. This comes since, except polynomial
  $\p{t} (X, Y)$ all polynomials are computed following the protocol. For
  polynomial $\p{t} (X, Y)$ we observe that in a case of both real and simulated
  proof the verifier only learns commitment $\gone{t} = \p{t} (\chi, y)$ and
  evaluation $t' = \p{t} (z, y)$. Since the simulator picks $\p{t} (X, Y)$ such
  that
  \begin{align*}
      \p{t} (X, y) = \p{r} (X, 1) (\p{r}(X, y) + \p{s} (X, y)) - \p{k} (Y)
  \end{align*}
  Values of $\gone{t}$ are equal in both proofs.
  Furthermore, the simulator picks its polynomial such that $\p{t}(0, y) = 0$,
  hence it does not need the trapdoor to commit to it. (Note that the proof
  system's SRS does not allow to commit to polynomials which have non-zero
  constant term). \qed
\end{proof}
\begin{remark}
  As noted in \cite{CCS:MBKM19}, $\sonic$ is statistically subversion zero-knowledge (Sub-ZK). As noted in \cite{AC:ABLZ17short}, one way to achieve
  subversion zero-knowledge is to utilize an extractor that extracts a SRS
  trapdoor from a SRS-generator. Unfortunately, a NIZK made subversion
  zero-knowledge by this approach cannot achieve perfect Sub-ZK as one has to
  count in the probability of extraction failure. However, with the simulation
  presented in \cref{lem:sonic_hvzk}, the trapdoor is not required for the
  simulator as it is able to simulate the execution of the protocol just by
  picking appropriate (honest) verifier's challenges. This result transfers to
  $\sonicprotfs$, where the simulator can program the random oracle to provide
  challenges that fits it.
\end{remark}

\subsection{Simulation Extractability of $\sonicprotfs$}
Since \cref{lem:sonicprot_ur,lem:sonicprot_ss,lem:sonic_hvzk} hold, $\sonicprotfs$ is $\ur{2}$, rewinding-based knowledge sound and trapdoor-less zero-knowledge. We now make use
of \cref{thm:se} and show that $\sonicprotfs$ is simulation-extractable as defined in \cref{def:simext}.

\begin{corollary}[Simulation extractability of $\sonicprotfs$]
  \label{thm:sonicprotfs_se}
  $\sonicprotfs$ is \emph{updatable simulation-extractable} against any $\ppt$ adversary $\advse$ who makes up to $q$ random oracle queries and returns an accepting proof with probability at least $\accProb$ with extraction failure probability
\[
  \epsse(\secpar, \accProb, q) \leq \left(1 - \frac{\accProb - \epsur (\secpar) - (q + 1) \epserr (\secpar)} {1 - \epserr (\secpar)}\right) + (\noofc + 1) \cdot \epsuldlog (\secpar) ,
\]
where $\epserr (\secpar) = \frac{\noofc}{p}$, $p$ is the size of the field, and $\noofc$ is the number of constrains in the circuit.
\end{corollary}

%%% Local Variables:
%%% mode: latex
%%% TeX-master: "main"
%%% End:


\chapter{Defining the problem}

\section{Predict the cultivar of wine}
We have data from wines from three different cultivars from the same region in Italy \cite{info}. Given some qualities from the wine, like alchohol, acid, etc. we have to predict which cultivar derived an instance.

\section{History of the dataset}
The dataset was dontated by Riccardo Leardi, the data is from three different cultivars from the same region in Italy \cite{info}.

\section{Attribute information}
All attributes are continuous
\begin{enumerate}
    \item Alchohol
    \item Malic acid
    \item Ash
    \item Alcalinity of ash
    \item Magnesium
    \item Total phenols
    \item Flavanoids
    \item Nonflavanoid phenols
    \item Proanthocyanins
    \item Color intensity
    \item Hue
    \item OD280/OD315 of diluted wines
    \item Proline
\end{enumerate}

\section{First look at the dataset}
There are a lot of features that seem to separate the features quite well. For this reason, discriminant analysis looks very promising, since it finds a linear combination of features that best suits the problem. The baseline accuracy is 40\%, since that is what we get when we always predict the major class.

\chapter{Analyze the data}
\section{Handling missing values}
There are no missing values in the dataset
\section{Normalization and standardization}
We may benefit from standardization, since some attributes have a Gaussian-like distribution.

\chapter{Prepare data}
To analyze the dataset, we will use the following views of the dataset:
\section{Raw view of the dataset}
The dataset in the same view as we downloaded it.
\section{Standardized view of the dataset}
The dataset after applying the standardize filter

\chapter{Evaluate algorithms}
\section{Initial experiment design}
We will run the experiment design on the the two datasets descibed in the previous chapter (raw and standardized) on the following algorithms:
\begin{enumerate}
    \item Decision tree - C4
    \item Naive Bayes
    \item Logistic regression
    \item Linear discriminant analysis
    \item Quadratic discriminant analysis
    \item Support vector machine using sequantial minimal optimization
    \item Multilayer perceptron
    \item Nearest neighbour
\end{enumerate}
The results show 99,16\% accuracy for Quadratic Discriminant Analysis. Since the results are on 10-fold cross validation, we are not overfitting and the results confirm our intuition that the classes are clearly separable through a combination of the attributes.

\chapter{Present results}


\chapter{Introduction}
\label{cha:introduction}

For a machine to interact in an intelligent manner with its outside world, it needs to be
equipped with suitable knowledge.  The very same is true for humans, and acquiring this
knowledge is a highly complex task which up to today is not completely understood.  To
help within this process, previously acquired knowledge is \emph{represented} in different
ways, \eg as books or films, to help others learning it.

However, the way knowledge is represented for human consumption is almost always not
suitable for machines.  While humans can extract knowledge from natural language, which
may be full of ambiguity, machines require precise formulations of knowledge.  The
representation of knowledge in a machine-understandable way is the main focus of the area
of \emph{knowledge representation}~\cite{KRhandbook}.

One of the most successful approaches to knowledge representations are description
logics~\cite{DLhandbook}, a family of logic-based knowledge representation formalisms
with varying expressivity and reasoning complexity.  Description logics allow to represent
knowledge as \emph{knowledge bases}, or \emph{ontologies}.  Essentially, these are
collections of axioms, which may be either \emph{assertional} or \emph{terminological}.
For example, to represent the fact (the \emph{assertion}) that an individual \textsf{tom}
is a cat, one can use the assertional axiom
\begin{equation}
  \label{eq:14}
  \mathsf{Cat}(\mathsf{tom}).
\end{equation}
On the other hand, to state the terminological knowledge that every cat hunts mice, one
can use so-called \emph{general concept inclusions} (GCIs) and write
\begin{equation}
  \label{eq:15}
  \mathsf{Cat} \sqsubseteq \exists \mathsf{hunts}. \mathsf{Mouse}.
\end{equation}
As soon as a knowledge base is available, it is possible to \emph{reason} with it, \ie to
extract knowledge from it that is implicitly contained.  For example, from the two axioms
stated above, we can infer that the individual \textsf{tom} hunts mice, although this has
never been stated explicitly.

Knowledge bases can be used to represent knowledge in a machine-consumable way.  However,
the question arises how such knowledge bases can be obtained.  One way or the other,
knowledge which is available to humans has to be translated into the form of a description
logic knowledge base.  Of course, this could be done by humans, but this approach would
not only be very time-consuming, but also prone to errors.  An automatic translation would
thus be highly welcomed.  On the other hand, a completely automatic translation would just
mean that machines can consume knowledge in the way humans represent it, an assumption
which is not reasonable.

However, one can still think about approaches which are \emph{semi-automatic} in the sense
that the results obtained from such a translation are preliminary, requiring further
refinement, or that the translation procedure requires additional \emph{assistance} by
means of human experts.

An approach to achieve such a semi-automatic translation procedure, or \emph{learning
  procedure}, has been made in~\cite{Diss-Felix}.  There, the focus lies on extracting
terminological knowledge of the form as shown in \Cref{eq:15} from some given \emph{finite
  interpretation} $\mathcal{I}$.  More precisely, the procedures described
in~\cite{Diss-Felix} would automatically learn all GCIs which are \emph{valid} in the data
set $\mathcal{I}$.  This approach makes use of the mathematical theory of \emph{formal
  concept analysis}, a subfield of mathematical order theory, which has very close
connections to description logics.

Of course, the GCIs learned this way may not be correct, in the sense that the GCI may
hold in $\mathcal{I}$, but this data missed to contain some relevant counterexamples.  In
this case, we say that $\mathcal{I}$ is \emph{incomplete}.  One way to remedy this is to
use an algorithm from formal concept analysis called \emph{attribute exploration}, and
generalize it to the setting of GCIs.  Such a generalization, called \emph{model
  exploration}, has been discussed in~\cite{Diss-Felix}.  Within this algorithm, an expert
(possibly human) is asked for the correctness of extracted GCIs, and if such a GCI is not
correct, the expert has to provide \emph{counterexamples} for it.  This way, the problem
of $\mathcal{I}$ being incomplete can be solved.

However, there are still problems with the original approach of~\cite{Diss-Felix}, in
particular concerning the \emph{quality} of the data $\mathcal{I}$ from which GCIs are
learned.  The main problem here is that the data may contain \emph{errors}.  These errors
may either cause otherwise valid GCIs not to be found, because these errors act as
\emph{false counterexamples}, or GCIs to be found which are not correct, because errors
cause positive counterexamples to vanish.  While the latter approach can in theory be
handled by the attribute exploration approach sketched above, the former cannot, because
the approach discussed in~\cite{Diss-Felix} will not even extract GCIs for which there may
be false counterexamples in $\mathcal{I}$.

In this work, we want to extent the results obtained in~\cite{Diss-Felix} to this new
setting of where the data $\mathcal{I}$ may contain errors.  The main approach for this is
to transfer the notion of \emph{confidence}~\cite{arules:agrawal:association-rules} from
the area of data-mining to GCIs.  Intuitively, this means that GCIs may have \emph{few}
errors in the data, as opposed to having none in the original approach
of~\cite{Diss-Felix}.  The notion of \enquote{few} is quantified by means of the
confidence of the GCIs in the data.

In the following, we shall give a more in-depth discussion of what we want to do in this
work.  To this end, we first shall introduce description logics and formal concept
analysis, in an exemplary and historic manner.  Thereafter, we shall discuss the main
results of~\cite{Diss-Felix} in more detail, and also briefly mention some other related
work.  Finally, we present the main contributions of this work.

\section{Description Logics}
\label{sec:repr-knowl-using}

Description logics~\cite{DLhandbook} are a family of logic-based knowledge representation
formalisms, with a strong emphasis on well-defined semantics and practical reasoning
procedures.  The family of description logics contains various kinds of logical
formalisms, varying in expressiveness and reasoning complexity, allowing users to choose
the expressiveness they need, or the complexity they can afford in their respective
applications.

The development of description logics~\cite{journals/sLogica/BaaderS01} was motivated by
earlier knowledge representation formalisms like \emph{semantic
  networks}~\cite{SemanticNetworks} or \emph{frame}~\cite{Minsky-Frames}, whose semantics
were highly ambiguous, and mostly depended on human interpretation or implementation
details.  The need for well-defined and predictable knowledge representation formalisms
then led to the first logic-based systems~\cite{journals/cogsci/BrachmanS85}, which
however were incomplete~\cite{conf/kr/Schmidt-Schauss89}.

The first description logics considered were relatively small fragments of first order
logic, and already for them it could be shown that reasoning is
intractable~\cite{conf/aaai/BrachmanL84,journals/ai/Nebel88}.  One approach to remedy this
was to investigate highly optimized reasoning algorithms, which behave well in practice.
The most prominent class of such algorithms are \emph{tableau algorithms}.  These
algorithms were first invented for the description logic
$\ALC$~\cite{journals/ai/Schmidt-SchaussS91,conf/ecai/HollunderNS90} for the subsumption
problem, and were thereafter extended to other, even more expressive logics.  After a
connection of $\ALC$ to multimodal logic $\mathsf{K}_{(\mathsf{m})}$ was
discovered~\cite{DBLP:conf/ijcai/Schild91}, it was seen that this tableau algorithm is
actually a re-invention of the tableau algorithms used in modal logics.  The development
of description logics continued to investigate highly expressive description logics, whose
expressiveness exceeds that of $\ALC$, but which still behave well in
practice~\cite{journals/igpl/HorrocksST00}, and for which highly-optimized implementations
exist~\cite{sirin_pellet:practical_2007,Haarslev:2001,DBLP:conf/cade/TsarkovH06}.  This
finally led to the adoption of the \emph{Web Ontology Language OWL} by the W3C, which is
based on the highly expressive description logic
$\mathcal{S}\mathcal{H}\mathcal{O}\mathcal{I}\mathcal{N}$~\cite{horrocks03fromshiqrdftoowl}.

The focus of description logics research departed from the sole focus on expressive
description logics when, at the beginning of this millennium, it was discovered that for
the inexpressive description logic $\EL$ reasoning is
tractable~\cite{DBLP:conf/ijcai/Baader03a,DBLP:conf/ecai/Brandt04}, and stays so when the
expressiveness of $\EL$ is extended
slightly~\cite{DBLP:conf/ijcai/BaaderBL05,BaaderEtAl-OWLED08DC}.  A practical relevance of
these results is given by the fact that large biomedical ontologies can be reformulated as
\emph{description logic knowledge bases} (or \emph{description logic ontologies}) using
$\EL$ or such slight extensions of it.  Examples for this are the \emph{Systematized
  Nomenclature of Medicine--Clinical Terms}, the Gene Ontology~\cite{gene-ontology}, and
large parts of the GALEN ontology~\cite{Rector199475}.

The term \enquote{description} in \enquote{description logics} is motivated by the
intention to use description logics to express knowledge about \emph{concept
  descriptions}.  For this, description logics provide a number of constructors, which can
then be used to build concept descriptions from atomic \emph{concept names} and binary
\emph{role names}.  For example, the description logic $\EL$ provides the constructors
\emph{conjunction} ($\sqcap$) and \emph{existential restriction} ($\exists$).  Examples of
$\EL$ concept descriptions are
\begin{equation*}
  \mathsf{Cat},\, \mathsf{Cat} \sqcap \mathsf{Mouse},\, \exists \mathsf{hunts}. \mathsf{Mouse},
\end{equation*}
where \textsf{Cat}, \textsf{Mouse} are concept names, and \textsf{hunts} is a role name.

A description logic knowledge base formulated in $\EL$ consists, like most description
logic knowledge bases, of two parts, namely an \emph{ABox}, holding assertional knowledge,
and a \emph{TBox}, containing terminological knowledge.  An example knowledge base is
\begin{equation*}
  \mathcal{K} = (\set{ \mathsf{Cat} \sqsubseteq \exists \mathsf{hunts}. \mathsf{Mouse} },
  \set{ \mathsf{Cat}(\mathsf{tom}) }),
\end{equation*}
where the first entry denotes the TBox, and the second denotes the ABox.  The semantics of
knowledge bases is defined using \emph{interpretations} $\mathcal{I}$, which can be
thought of as directed edge- and vertex-labeled graphs.  The labels of the vertices, which
we shall call \emph{elements} or \emph{individuals}, are concept names, and the labels of
the edges are role names.  An interpretation is a model of a knowledge base if all
elements \emph{satisfy} the axioms contained in this knowledge base.  For example, the
interpretation
\begin{center}
  \begin{tikzpicture}
    \begin{scope}[
      every node/.style = { draw, circle },
      every label/.style = { draw = none, rectangle }
      ]
      \node[label=above:{\textsf{Cat}}] (Tom) {\textsf{tom}};
      \node[label=above:{\textsf{Mouse}}, right=2cm of Tom, inner sep = .1cm] (Jerry)
      {\textsf{jerry}};
    \end{scope}
    \path (Tom) edge[->, bend left=30] node[midway, above] {\textsf{hunts}} (Jerry);
    \path (Jerry) edge[->, bend left=30] node[midway, below] {\textsf{hunts}} (Tom);
  \end{tikzpicture}
\end{center}
is a model of the knowledge base $\mathcal{K}$, since the element \textsf{tom} is labeled
\textsf{Cat}, and every element which is labeled with \textsf{Cat} is connected to some
element labeled \textsf{Mouse} via an edge labeled with \textsf{hunts}.

As soon as one has a description logic knowledge base, one can conduct \emph{reasoning}
with it, \ie one can extract knowledge from the knowledge base that may be only contained
in it implicitly.  Two classical reasoning problems are \emph{instance checking} and
\emph{subsumption}: given an \emph{individual name} $a$ and a concept description $C$, the
instance checking problem is to ask whether $a$ is an \emph{instance} of $C$, \ie whether
$a$ satisfies the concept description $C$ in every interpretation.  The subsumption
problem is to ask, given two concept descriptions $C$ and $D$, whether it is true that $C$
is a \emph{subconcept} of $D$, \ie whether it is true in every interpretation that every
element that satisfies $C$ also satisfies $D$.  Other reasoning problems are
\emph{knowledge base consistency} and \emph{concept satisfiability}: a knowledge base is
consistent if it has a model, and a concept description $C$ is satisfiable with respect to
a given knowledge base $\mathcal{K}$ if there exists a model of $\mathcal{K}$ containing
elements that satisfy $C$.  Deciding knowledge base consistency and concept satisfiability
can help to ensure the correctness of the given knowledge base.

\section{Formal Concept Analysis}
\label{sec:learn-impl-using}

Formal concept analysis~\cite{fca-book} is a subfield of mathematical order theory,
originally concerned with the study of properties of ordered structures called
\emph{complete lattices} by representing them in terms of so-called \emph{formal
  contexts}.  Since then, formal concept analysis has considerably broadened its scope,
with connections to previously unrelated subjects such as
logics~\cite{books/math/Prediger00,conf/iccs/FerreR00}, data
mining~\cite{arules:Zaki:1998}, machine learning~\cite{conf/icfca/Kuznetsov04}, and
artificial intelligence~\cite{phd/de/Rudolph2006,Diss-Felix}.  Because of this, formal
concept analysis today can be considered as a part of theoretical computer science, and
thus it provides another link between computer science and mathematics.

The origin of formal concept analysis as it is used in this work can clearly be marked by
the work of Wille~\cite{fca:Wille:1982}, which introduced formal concept analysis as an
approach to impose meaning on complete lattices by considering them as \emph{hierarchies
  of concepts}.  This work was motivated by previous results from
Birkhoff~\cite{books/math/Birkhoff67}, but also has a strong philosophical
background~\cite{books/phil/Hentig72,Wille:Begriffsdenken}.  Another early work that
included some of the ideas of formal concept analysis is~\cite{OrdreEtClassification}.

\begin{figure}[tp]
  \centering
  \begin{math}
    \begin{array}[c]{c|*{7}{c}}
      \toprule
      ~       & \mathsf{small} & \mathsf{medium} & \mathsf{large} & \mathsf{inner} &
      \mathsf{outer} & \mathsf{moon} & \mathsf{no moon} \\
      \midrule
      \mathsf{Mercury} & \times &   &   & \times &   &   & \times  \\
      \mathsf{Venus}   & \times &   &   & \times &   &   & \times  \\
      \mathsf{Earth}   & \times &   &   & \times &   & \times &    \\
      \mathsf{Mars}    & \times &   &   & \times &   & \times &    \\
      \mathsf{Jupiter} &   &   & \times &   & \times & \times &    \\
      \mathsf{Saturn}  &   &   & \times &   & \times & \times &    \\
      \mathsf{Uranus}  &   & \times &   &   & \times & \times &    \\
      \mathsf{Neptune} &   & \times &   &   & \times & \times &    \\
      \mathsf{Pluto}   & \times &   &   &   & \times & \times &    \\
      \bottomrule
    \end{array}
  \end{math}
  \caption{Example Formal Context (taken from~\cite{fca:Wille:1982})}
  \label{fig:example-formal-context}
\end{figure}

The fundamental idea of formal concept analysis is to represent complete lattices by an
\emph{object-attribute-relationship}, which is expressed using \emph{formal contexts}.
These structures can be thought of as \emph{tables of crosses}.  An example of a formal
context is depicted in \Cref{fig:example-formal-context}.  This example formal context
expresses an object-attribute-relationship between the \emph{objects} being the known
planets of the solar system (including Pluto), and the \emph{attributes} being certain
properties of these planets, like their size (\textsf{small}, \textsf{medium}, or
\textsf{large}), their distance from the sun (being an \textsf{inner} or \textsf{outer}
planet, \ie having an orbit which is closer to the sun than the asteroid belt or not), and
if they do or do not have a \textsf{moon}.  A cross in this table then means that the
object on the corresponding row \emph{has} the attribute on the corresponding column.
Thus, for example, \textsf{Mercury} is a \textsf{small} planet, and \textsf{Pluto} is an
\textsf{outer} planet.  The set of all pairs of objects $g$ and attributes $m$ where $g$
has the attribute $m$ is called the \emph{incidence relation} of the formal context.

Formally, a \emph{formal context} $\con K$ can be defined as a triple $\con K = (G, M,
I)$, where $G$ and $M$ are sets and $I \subseteq G \times M$.  $G$ is then called the set
of \emph{objects}, $M$ is called the set of \emph{attributes}, and the set $I$ is called
the \emph{incidence}.  An object $g \in G$ \emph{has} an attribute $m \in M$ in $\con K$
if and only if $(g, m) \in I$.

From such a formal context one can then extract \emph{formal concepts}, which can be
ordered in a natural way to yield the \emph{concept lattice} of the formal context.  In
our example above, a formal concept which corresponds to the concept of a
\emph{medium-sized planet in our known solar system} would be the tuple
\begin{equation}
  \label{eq:60}
  ( \set{ \mathsf{Uranus}, \mathsf{Neptune} }, \set{ \mathsf{medium}, \mathsf{moon},
    \mathsf{outer} } ),
\end{equation}
where the first set is called the \emph{extent}, and the second set is called the
\emph{intent} of the formal concept.

Formal concepts can then be ordered by set-inclusion of their extents, and it can be shown
that the thus-obtained ordered set is a complete lattice, the \emph{concept lattice} of
the formal context.  The concept lattice that corresponds to our small example above is
shown in \Cref{fig:example-concept-lattice}.  This diagram also uses the usual, abridged
annotation of concept lattices: a node $v$ in the lattice diagram represents the formal
concept whose extent consists of all objects which can be reached by an \emph{descending
  path} in the diagram, starting from $v$.  Likewise, the intent of $v$ is the set of all
attributes that can be reached by an \emph{ascending path} in the diagram, starting from
$v$.  Thus, the gray-shaded node in \Cref{fig:example-concept-lattice} is the formal
concept of \Cref{eq:60}.

\begin{figure}[tp]
  \tikzset{vertexbase/.style={semithick, shape=circle, inner sep=2pt, outer sep=0pt, draw},%
    vertex/.style={vertexbase},%
    mivertex/.style={vertexbase},%
    jivertex/.style={vertexbase},%
    divertex/.style={vertexbase},%
    conn/.style={-, thick}%
  }
  \begin{center}
    \begin{tikzpicture}
      \begin{scope}[xscale=.7] %for scaling and the like
        \begin{scope} %draw vertices
          \foreach \nodename/\nodetype/\xpos/\ypos in {%
            0/vertex/2/4,
            1/divertex/-4/7,
            2/jivertex/0/7,
            3/divertex/8/7,
            5/jivertex/4/7,
            6/mivertex/-2/8,
            7/vertex/2/8,
            8/mivertex/6/8,
            9/mivertex/0/9,
            10/mivertex/4/9,
            11/vertex/2/10
          } \node[\nodetype] (\nodename) at (\xpos, \ypos) {};
          \node[divertex,fill=black!30] (4) at (6,7) {};
        \end{scope}
        \begin{scope} %draw connections
          \path (7) edge[conn] (10);
          \path (9) edge[conn] (11);
          \path (5) edge[conn] (8);
          \path (1) edge[conn] (6);
          \path (0) edge[conn] (4);
          \path (0) edge[conn] (3);
          \path (8) edge[conn] (10);
          \path (5) edge[conn] (7);
          \path (6) edge[conn] (9);
          \path (2) edge[conn] (7);
          \path (0) edge[conn] (1);
          \path (3) edge[conn] (8);
          \path (2) edge[conn] (6);
          \path (10) edge[conn] (11);
          \path (7) edge[conn] (9);
          \path (4) edge[conn] (8);
          \path (0) edge[conn] (2);
          \path (0) edge[conn] (5);
        \end{scope}
        \begin{scope}[every label/.style={font=\sffamily, inner sep=1pt, fill opacity=.9,
            text opacity=1, fill=white, label distance=4pt}] %add labels
          \foreach \nodename/\labelpos/\labelopts/\labelcontent in {%
            1/below left//{\parbox{1.4cm}{Mercury\\ Venus}},
            1/above left//{no-moon},
            2/below//{\parbox{2cm}{\centering Mars\\ Earth}},
            3/below right//{\parbox{2cm}{Jupiter\\ Saturn}},
            3/above right//{large},
            4/below//{\parbox{1.4cm}{\centering Uranus\\ Neptune}},
            5/below//{Pluto},
            6/above left//{inner},
            8/above right//{outer},
            9/above left//{small},
            10/above right//{moon}
          } \node[draw=none,label={[\labelopts]\labelpos:{\labelcontent}}] at (\nodename) {};
          \node[draw=none,label={[label distance=1pt]above:medium}] at (4) {};
        \end{scope}
      \end{scope}
    \end{tikzpicture}
  \end{center}
  \caption{Example Concept Lattice}
  \label{fig:example-concept-lattice}
\end{figure}

One of the key results of formal concept analysis is that every complete lattice can be
represented as a concept lattice of a suitably chosen formal context (this is the
so-called \emph{fundamental theorem of formal concept analysis}).  A major direction of
formal concept analysis research is to consider properties and operations of lattices,
such as \emph{distributivity}, \emph{modularity}, \emph{direct} and \emph{semi-direct
  products}, and transfer them to corresponding properties and operations on the level of
formal contexts.  See~\cite{fca-book} for more details on this.

Another very prominent research direction in formal concept analysis is the study of
\emph{implications} in formal contexts, which has been discussed as early
as~\cite{fca:Wille:1982}.  Observe that in our example formal context above, all outer
planets have a moon.  We can express this fact as saying that the implication
\begin{equation*}
  \set{ \mathsf{outer} } \to \set{ \mathsf{moon} }
\end{equation*}
\emph{holds} in our formal context.  Implications are similar to \emph{functional
  dependencies} from the theory of databases~\cite{DBLP:books/cs/Maier83}, and also play a
certain role in classical order theory~\cite{Wild1994118}.

One task is to compute the set of all valid implications of a given formal context.  Since
this set can be quite large, one usually wants to compute \enquote{small} sets of
implications which are sufficient, called \emph{bases}.  One very prominent base is the
so-called \emph{canonical base}~\cite{fca:DuquenneGuigues:1986} (also \emph{stem base},
\emph{Duquenne-Guigues base}), which is a \emph{minimal} base, \ie a base with minimal
cardinality.  This base can be computed
effectively~\cite{DBLP:conf/icfca/Ganter10,DBLP:journals/amai/ObiedkovD07}, however these
algorithms are not efficient~\cite{DBLP:conf/icfca/Distel10} with respect to the size of
the input and the output.  Certain complexity results suggest that efficiently computing
the canonical base is not possible in general~\cite{DBLP:journals/dam/BabinK13}.  However,
if this is really the case is an open research question.  Therefore, other bases have been
investigated, whose computation is algorithmically easier.  An example is the base of
\emph{proper premises}~\cite{fca-book}, for which fast algorithms
exist~\cite{RyDiBo-AMAI13}.

An algorithm that is related to the study of valid implications of formal contexts is
\emph{attribute exploration}~\cite{fca-book,GORS-book}, which is an interactive process
which extracts valid implications from \emph{incomplete} data utilizing \emph{expert
  interaction} to obtain missing facts.  Within this process, an external expert is asked
questions of the form
\begin{equation*}
  \text{Is the implication } A \to B \text{ valid?}
\end{equation*}
The expert then can either accept this implication, or decline it by providing a
\emph{counterexample}.  In this way, the expert enriches the currently known formal
context by missing objects and their attributes.  As soon as the process finishes, the set
of confirmed implications represents the whole implicational knowledge represented by the
expert.  Moreover, it can be shown that the set of confirmed implications is the canonical
base of the formal context which consists of the initially known objects together with all
counterexamples provided by the expert.  In this way, attribute exploration can be seen as
a semi-automatic knowledge acquisition algorithm.

Attribute exploration has been a major focus of formal concept analysis research, and many
extensions of this algorithm have been developed and discussed.  Examples for this are the
inclusion of \emph{background
  knowledge}~\cite{stumme96attribute,DBLP:journals/tcs/Ganter99}, \emph{concept
  exploration}~\cite{conf/iccs/Stumme97}, \emph{rule
  exploration}~\cite{phd/de/Zickwolff1991}, \emph{relational
  exploration}~\cite{phd/de/Rudolph2006}, exploration in the presence of \emph{partial
  knowledge}~\cite{book/fca/BurmeisterH05,conf/ijcai/BaaderGSS07}, and \emph{model
  exploration}~\cite{Diss-Felix}.

\section{Extracting Terminological Knowledge from Relational Data}
\label{sec:extr-term-knowl}

The main purpose of this work is to discuss a way to extract general concept inclusions
from interpretations which are allowed to contain errors.  The basis for our
considerations are the results obtained by Baader and
Distel~\cite{Diss-Felix,BaDi09,BaaderDistel08} on computing \emph{finite bases} of
\emph{valid} GCIs from finite interpretations.  In the following, we shall briefly
summarize the main results of this approach.

The goal of the work by Baader and Distel is to learn terminological knowledge about a
certain \emph{domain} of interest.  For this we assume that we can represent this domain
as a finite interpretation $\mathcal{I}$, \ie our domain is representable as relational
data.  The terminological knowledge we are then interested in is the set
$\Th(\mathcal{I})$ of valid GCIs of $\mathcal{I}$, using the description logic $\ELbot$.

A first problem here is that the set $\Th(\mathcal{I})$ is infinite in general: if $C
\sqsubseteq D$ is valid in $\mathcal{I}$, and if $r$ is a role name, then the GCI $\exists
r. C \sqsubseteq \exists r. D$ is also valid in $\mathcal{I}$.  To remedy this, Baader and
Distel compute \emph{finite bases} of $\Th(\mathcal{I})$, \ie finite subsets $\mathcal{B}$
of $\Th(\mathcal{I})$ which are already \emph{complete} for $\mathcal{I}$.  In other
words, finite bases $\mathcal{B}$ are finite sets of valid GCIs of $\mathcal{I}$, such
that every GCI valid in $\mathcal{I}$ is already entailed by $\mathcal{B}$.  One of the
main results of their approach is that such finite bases always exist, and that they can
be computed effectively.

To provide these results, Baader and Distel exploit the tight connection between the
description logic $\ELbot$ and formal concept analysis, established by \emph{model based
  most specific concept descriptions} and \emph{induced formal contexts} of finite
interpretations and sets of concept descriptions.  More precisely, it can be shown that if
$\con K_{\mathcal{I}}$ denotes the induced formal context of $\mathcal{I}$, then every
base of $\con K_{\mathcal{I}}$ gives rise to a finite base of $\mathcal{I}$.  A technical
problem that arises here is that model-based most-specific concept descriptions are not
necessarily expressible in the description logic \ELbot.  Because of this, Baader and
Distel consider the description logic \ELgfpbot, an extension of \ELbot by \emph{cyclic
  concept descriptions} using \emph{greatest fixpoint semantics}.

The resulting algorithms for computing bases of finite interpretations are all effective.
A preliminary implementation with applications to linked data has been presented
in~\cite{DBLP:conf/icdm/BorchmannD11}.

An additional issue addressed by Baader and Distel is the fact that the interpretation
$\mathcal{I}$ may be \emph{incomplete}, \ie certain facts from the domain of interest may
not be represented in it.  The GCIs which are valid in $\mathcal{I}$ may not necessarily
be valid in the domain of interest.  This problem is very similar to the problem solved by
attribute exploration, and indeed it can be shown that attribute exploration applied to
the context $\con K_{\mathcal{I}}$ can be transferred into an algorithm for \emph{model
  exploration} of $\mathcal{I}$.  This algorithm then allows to interactively compute
bases of $\mathcal{I}$, allowing an expert to provide missing facts when required.  In
this way, learning GCIs which are invalid in the domain of interest can be avoided.

\section{Other Related Work}
\label{sec:related-work}

The work of Baader and Distel is not the first attempt to bring together the worlds of
description logics and formal concept analysis.  Indeed, there have been several previous
attempts to utilize formal concept analysis for description logic applications, and to add
ideas from description logics to notions of formal concepts analysis.

One of the first results in description logics that utilizes formal concept analysis is
the work of Baader~\cite{Baader-KRUSE-95}.  In this work, Baader uses the attribute
exploration algorithm on a special formal context to compute a minimal representation of
the subsumption hierarchy between all conjunctions of the defined concept names of a given
acyclic TBox $\mathcal{T}$ formulated in the logic $\ALC$.  To this end, Baader extends
the classical tableau algorithm for \ALC to decide subsumption between \emph{single}
defined concept names~\cite{journals/ai/Schmidt-SchaussS91}, and extends it in such a way
that it provides counterexamples to instances of the subsumption problem.  These
counterexamples are then collected into a suitable formal context, and from this context
the attribute exploration algorithm eventually computes the canonical base.  These
implications give rise to a set of GCIs, which can then be used to decide subsumption
between conjunctions of defined concept names of $\mathcal{T}$.

The results obtained by Baader have been further generalized by
Stumme~\cite{stumme96concept} to also include disjunction.  For this, a generalization of
attribute exploration called \emph{distributive concept
  exploration}~\cite{conf/ki/Stumme98} has been used.

Another use of formal concept analysis for description logic applications is in
\emph{knowledge base completion}~\cite{Sert07,conf/ijcai/BaaderGSS07}, for which again
attribute exploration was used.  For this, the expert is asked GCIs of the form
\begin{equation*}
  \bigsqcap U \sqsubseteq \bigsqcap V,
\end{equation*}
where $U, V \subseteq M$ for some previously chosen set $M$ of \emph{interesting
  concepts}.  The goal is then to ensure the given knowledge base is complete with respect
to all these GCIs, \ie the knowledge base should entail all such GCIs which are confirmed
by the expert, and should contain counterexamples for all other GCIs of the above type.
The greatest challenge for transferring attribute exploration to this setting is to deal
with the \emph{open world semantics} of description logic knowledge bases: if a fact is
not entailed by the knowledge base, then this does not mean that the negated fact holds.
For this, attribute exploration is generalized to work on \emph{partial contexts}, \ie
formal contexts in which certain crosses are unknown.  The resulting algorithm has been
implemented as a plugin named \emph{OntoComp} for the ontology editor
\emph{Protégé}~\cite{conf/esws/Sertkaya09}.

A third prominent application of ideas of formal concept analysis in description logics is
the work of Rudolph on \emph{relational
  exploration}~\cite{phd/de/Rudolph2006,conf/iccs/Rudolph04}.  In this approach the target
description logic is \FLE, the extension of \EL by value restriction ($\forall$).  The
domain of interest is not represented as an interpretation, but by means of \emph{binary
  power context families}~\cite{DBLP:conf/iccs/PredigerW99}, which however can easily be
considered as an interpretation.  Then the exploration process is conducted in several
phases: in phase $k$, concept descriptions with \emph{role depth} at most $k$ are
considered as attributes of the current formal context, and on this formal context
attribute exploration is performed.  Rudolph then shows that this process has to be
considered only up to a certain maximal role depth, and that the resulting set of
implications can be used to decide whether an arbitrary GCI $C \sqsubseteq D$ is valid or
not in the domain represented by the expert.  However, it is not shown whether and how
this set of implications can be transferred into a base of the domain.  Indeed, the
decision procedure for checking whether $C \sqsubseteq D$ holds in the domain or not is
rather complicated.  Thus, no GCIs are learned from this approach, and thus it cannot be
used to obtain terminological knowledge from relational data.

The aforementioned approach of \emph{power context families} is an attempt to add
description logic expressibility to the world of formal concept analysis.  In its easiest
form a formal context is equipped with a family of relations $\mathcal{R}$ on the object
set to obtain a \emph{relational context}.  Based on this notion, \emph{terminological
  attribute logic}~\cite{books/math/Prediger00} has been introduced that allows to define
new attributes in terms of old ones, using the relational context to extend the incidence
relation to the newly defined attributes.  With this semantics, terminological attribute
logic can be seen as a syntactic variant of \ALC extended by inverse roles, negated roles
and the identity role.  Terminological attribute logic can also be defined for
\emph{many-valued contexts} to provide a method for \emph{logical
  scaling}~\cite{conf/krdb/PredigerS99}, which transforms many-valued contexts into the
usual (two-valued) formal contexts in another way as the usual scaling approach of formal
concept analysis.

Another approach to bring a flavor of description logics to formal concept analysis is
\emph{relational concept analysis}~\cite{conf/icfca/RouaneHNV07,
  journals/amai/HaceneHNV13}.  The basic structure in this approach is a \emph{relational
  context family}, which consists of a family of formal contexts and a set of relations
between objects of possibly different contexts of this family.  Using a method called
\emph{relational scaling} new attributes $r : C$ are added to the formal contexts, which
roughly correspond to concept descriptions of the form $\forall r. C$ or $\exists r. C$,
where however $C$ is now a formal concept of a formal context of the family.  In an
iterative process, relational scaling is used to construct lattices from all formal
contexts of the relational context family.  These lattices can then be used to derive
assertional and terminological knowledge formulated in the description logic \FLE.

Other research that is related to this work are approaches in formal concept analysis and
description logics to tackle the problem of \emph{uncertainty} and \emph{vagueness}.  In
the area of formal concept analysis, the most notable and relevant work is the one by
Luxenburger~\cite{diss:Luxenburger,Luxenburger91}, who considers implications in formal
contexts together with an \emph{accuracy} (confidence).  Luxenburger then studies the
problem of \emph{realizations} of partial implications, which in terms of logic is just
the question whether a set of partial implications is satisfiable.  The results obtained
here give a characterization in terms of \emph{linear programs}.  Furthermore, he studies
the problem of finding \emph{bases} of partial implications, and we shall use the main
ideas in our later considerations.  Luxenburger's ideas have been used in the area of data
mining, for instance to obtain smaller representations of \emph{association
  rules}~\cite{DBLP:conf/ki/StummeTBPL01}.

Another prominent approach to handle knowledge that may not be completely correct is to
consider fuzzy extensions of the respective formalisms.  Those exist for both description
logics~\cite{journals/fss/BobilloS09,journals/ws/LukasiewiczS08} and formal concept
analysis~\cite{Pollandt97b,conf/cla/BelohlavekV05}, and are either based on Zadeh's
original approach to fuzzy logics~\cite{journals/iandc/Zadeh65}, or on the approach by
Hájek~\cite{hajek1998metamathematics}, in which the semantics is defined using
\emph{t-norms} on lattices.  In both cases, logical facts (implications, assertional
knowledge, terminological knowledge) are annotated with \emph{truth values} from an
underlying lattice, and the semantics then allows to infer truth values for previously
unknown facts, or at least bounds thereof.

Finally, a completely different approach to learning terminological knowledge has been
developed recently~\cite{conf/dlog/KonevLW13}, based on a general framework of \emph{query
  learning} proposed by~\cite{journals/ml/Angluin87}.  In contrast to the work by Baader
and Distel, this approach tries to learn TBoxes $\mathcal{T}$ by posing queries to an
\emph{oracle}.  These queries are either \emph{entailment queries}, in which the oracle
has to decide whether a proposed GCI is entailed by the TBox $\mathcal{T}$ to be learned,
or \emph{equivalence queries}, where the oracle has to decide whether a given TBox is
equivalent to $\mathcal{T}$.  The work~\cite{conf/dlog/KonevLW13} then considers
the question for which description logic the TBox $\mathcal{T}$ can be learned in
polynomial time.  In particular, it is shown that if $\mathcal{T}$ is an \emph{acyclic
  \EL-TBox}, then it cannot be learned in polynomial time.

Note that entailment queries are similar to the questions proposed to an expert during
attribute exploration.  In fact, it is possible to show that a certain special case of
query learning~\cite{journals/ml/AngluinFP92} can be used to obtain an alternative
computation of the canonical base~\cite{journals/ml/AriasB11}.

\section{Contributions}
\label{sec:contributions}

The main contributions of this thesis are the following.

\subsection{Experiments with Extracting Valid GCIs}
\label{sec:exper-with-extr}

All results obtained by Baader and Distel are \emph{effective}, meaning that the resulting
algorithms can be implemented and applied to relational data.  As a first contribution of
this work, we shall present an implementation of these algorithms in
\Cref{sec:computing-bases-from}.  We then apply this implementation to relational data
from the \emph{DBpedia project}~\cite{DBpedia}, which obtains its data by crawling
\emph{infoboxes} of Wikipedia articles.  We shall see that the approach by Baader and
Distel indeed is able to extract terminological knowledge from this data, and we shall
discuss the corresponding outcome in detail.

The main observation of these experiments however is that the errors in the DBpedia data
set inhibit GCIs from being found which otherwise would be relevant for the domain of the
chosen data.  The main example is that the GCI
\begin{equation*}
  \exists \mathsf{child}. \top \sqsubseteq \mathsf{Person}
\end{equation*}
stating the fact that every individual which has a child is a person, was not found during
our experiments.  The reason for this is that input data contained four counterexamples
for this GCI, which however were all erroneous.  On the other hand, the input data
contained 2547 \emph{positive examples} for this GCI.  This shows that the original
approach of Baader and Distel is very sensitive to errors in the input data, even if they
are comparably rare.

\subsection{Extracting GCIs with High Confidence from Erroneous Data}
\label{sec:extracting-gcis-from}

A main result from our experiments is that errors in the input data can inhibit otherwise
valid GCIs from being extracted.  On the other hand, we can assume that the input data
must be of sufficient \emph{quality} to reasonably extract terminological knowledge from
it, \ie must not contain too many errors which are relevant for our computations.  Based
on this assumption we generalize the approach by Baader and Distel from computing bases of
valid GCIs to computing bases of GCIs which are \emph{almost valid} in the input data.  To
formalize the notion of being \emph{almost valid}, we make use of the notion of
\emph{confidence} as it is used in data-mining, and transfer it to the setting of GCIs.
Instead of computing bases of valid GCIs, we then want to compute bases of GCIs whose
confidence is above a certain threshold $c$, for some chosen value $c \in [0,1]$.  Those
GCIs we shall call GCIs \emph{with high confidence}.  We shall see that we can generalize
most of the results of Baader and Distel accordingly, using Luxenburger's ideas on his
investigation of partial implications in formal contexts.  An example for such a result is
the fact that bases of the induced context of a finite interpretation give rise to a base
of the finite interpretation itself.  We shall see that we can generalize this result to
obtain that bases of implications with high confidence in the induced context give rise to
bases of GCIs with high confidence in the finite interpretation.  Finally, we shall apply
our results to the data sets we used for our experiments, to show that our approach is
able to handle certain errors in the input data.

\subsection{Exploration by Confidence}
\label{sec:expl-conf-2}

The approach of considering GCIs with high confidence is a purely heuristic one: by
considering GCIs with high confidence, we can ignore rare errors in the input data.
However, our approach ignores \emph{rare counterexamples} as well, \ie counterexamples
which are actually valid, but occur so infrequently that the confidence measures ignores
them.  In this case, an external source of information is needed that can distinguish
between errors and rare counterexamples in the data.  An example for such an external
source of information could be a human expert, who then considers all such counterexamples
manually, and decides whether they are valid or not.

Expert interaction can also be used to tackle another problem with data, namely its
\emph{incompleteness}: for certain GCIs relevant counterexamples may exist in the domain
of interest, but may not be present in the given data set.  In other words, we still
assume that our domain is represented by an interpretation, the so-called \emph{background
  interpretation}, but we only have access to some part of it.  In this case, both the
original approach by Baader and Distel, as well as our extension to GCIs with high
confidence would extract those GCIs for which relevant counterexamples are missing.  We
could use the external expert to avoid this issue, by querying this expert for possible
counterexamples from the background interpretation for all GCIs we would extract.

This expert interaction may be expensive, however, and an algorithm that keeps this
interaction to a minimum would be highly desirable.  In the case of valid implications of
a formal context, the attribute exploration algorithm would be such an algorithm, as it
asks the expert a minimal number of different questions.  Therefore, we want to generalize
attribute exploration to the setting of GCIs with high confidence to obtain an algorithm
that allows the use of an expert to distinguish between errors and rare counterexamples.

As a first step, we shall consider the easier problem of exploring \emph{implications with
  high confidence} instead of GCIs.  In this step, we shall generalize attribute
exploration to \emph{exploration by confidence}, where the algorithm not only asks the
expert after implications which are valid in the current context, but also after those
which only have high confidence.  For this, we first investigate generalizations of
attribute exploration which allow us to explore \emph{sets of implications}.  In these
generalizations, a set $\mathcal{L}$ of implications can be specified for which the expert
should decide which elements of $\mathcal{L}$ are valid.  In attribute exploration, the
set $\mathcal{L}$ is just the set of all valid implications of a given formal context.
For the case of implications with high confidence, the set $\mathcal{L}$ is then just the
set of all implications whose confidence is above a certain threshold $c$.

\subsection{Model-Exploration by Confidence}
\label{sec:model-expl-conf}

The problem of incomplete data already arises in the case of valid GCIs, and to approach
this problem Baader and Distel propose extensions of attribute exploration which also work
with valid GCIs.  One of these extensions, called \emph{model exploration}, works mostly
in the same way as attribute exploration does, with the difference that the expert now
gets asked GCIs for confirmation instead of implications.  Model exploration is
essentially attribute exploration of the induced context of the given interpretation,
although several technical problems have to be dealt with.

One of these problems it that the attribute set of the induced context depends on the
background interpretation.  Clearly, the background interpretation is not available during
the exploration process.  Model exploration solves this problem by computing the set of
attributes of the induced context incrementally during the computation.  Another problem
is the way counterexamples have to be specified: because of the \emph{closed world
  semantics} of interpretations, every counterexample provided by the expert has to be
\emph{complete}.  This means that as soon as the expert wants to provide an element as a
counterexample, all element which can be reached via directed edges from this elements in
the background interpretation have to be provided as well.  In other words, the
counterexamples provided by the expert have to be \emph{connected subinterpretations} of
the background interpretation.

To generalize model exploration to GCIs with high confidence, we essentially follow the
argumentation of model exploration.  More precisely, we shall consider exploration by
confidence of the induced context of the given interpretation, and transform it to
\emph{model exploration by confidence}, in a very similar way as model exploration arises
from attribute exploration of the induced context.

A notable difference to the argumentation of Baader and Distel is that we first have to
generalize our results about computing bases of GCIs with high confidence to include the
possibility that certain elements of the interpretation are \emph{trusted}, in the sense
that as soon as a trusted element is a counterexample for some GCI, this GCI is not
considered any further, even if its confidence is high enough.  The motivation for this
generalization stems from the fact that we consider all counterexamples provided by the
expert as valid.

%%% Local Variables:
%%% mode: latex
%%% TeX-master: "../main"
%%% End:

%  LocalWords:  Protégé OntoComp


\subsection{Random Two Peasants}
\subsubsection{Description of the Algorithm}
The main idea for the random two peasants algorithm is to sort the points along
a axis. The algorithm start from a random 2d point cloud \fref{rtp:base}

\begin{enumerate}
  \item sort all points along the x-axis.
  \item use the line \fref{rtp:line} from lowest point to greatest point
    on x-axis to divide the points in a upper \fref{rtp:upper} and a lower
    \fref{rtp:lower} point cloud.
  \item add sequential all points from the upper list to the polygon
    \fref{rtp:polygon-upper}
  \item add in reverse order all points from the lower list to the
    polygon \fref{rtp:polygon}
\end{enumerate}

\subsubsection{Implementation description}

\begin{enumerate}
  \item the function std::sort from the std lib does the sorting
  \item iterate over all points and perform the CGAL::orientation function to
    get the orientation of all points aligned at the line between the lowest
    point and the highest point.
  \item iterate over all points from the upper list and add it to the polygon
  \item iterate over all points from the lower list in reverse direction and add
    it to the polygon.
\end{enumerate}

\subsubsection{Complexitiy}

\begin{enumerate}
  \item sort all points along the x-axis. $\bigO(nlogn)$
  \item use the line from lowest point to greatest point on x-axis to divide the
    points in a upper and a lower point cloud. $\bigO(n)$
  \item add sequential all points from the upper list to the polygon $\bigO(n)$
  \item add in reverse order all points from the lower list to the polygon $\bigO(n)$
\end{enumerate}

This leads to $max(\bigO(nlogn) + \bigO(n) + \bigO(n) + \bigO(n) \Rightarrow \bigO(nlogn))$.

\subsubsection{Parameters}
\begin{description}
  \item [--nodes] how many nodes the polygon has to have. [default: 100]
  \item [--sampling-grid] the area within the polygon could grow. [default: 1500x800]
\end{description}

\subsubsection{Examples}

\begin{figure}[ht]
  \centering

  \begin{minipage}[t]{0.4\textwidth}
    \begin{tikzpicture}[yscale=0.05,xscale=0.05]
      \setcounter{i}{1}

      \draw[->] (0,0) -- (80,0) node[below] {$x$};
      \draw[->] (0,0) -- (0,70) node[left] {$y$};

      \foreach \p in {(1,11),(5,40),(10,20),(21,10),(20,18),(20,41),(33,15),(39,22),(48,9),(55,17),(60,50),(68,19)} {
        \node[point] (\arabic{i}) at \p {};
        \stepcounter{i}
      }
    \end{tikzpicture}
    \caption{Base random point cloud}
    \label{fig:rtp:base}
  \end{minipage}\hfill
  \begin{minipage}[t]{0.4\textwidth}
    \begin{tikzpicture}[yscale=0.05,xscale=0.05]
      \setcounter{i}{1}

      \draw[->] (0,0) -- (80,0) node[below] {$x$};
      \draw[->] (0,0) -- (0,70) node[left] {$y$};

      \foreach \p in {(1,11),(5,40),(10,20),(21,10),(20,18),(20,41),(33,15),(39,22),(48,9),(55,17),(60,50),(68,19)} {
        \node[point] (\arabic{i}) at \p {};
        \stepcounter{i}
      }

      \draw[blue] (1) -- (12);
    \end{tikzpicture}
    \caption{Dividing Line}
    \label{fig:rtp:line}
  \end{minipage}
\end{figure}

\begin{figure}[ht]
  \centering

  \begin{minipage}[t]{0.4\textwidth}
    \begin{tikzpicture}[yscale=0.05,xscale=0.05]
      \setcounter{i}{1}

      \draw[->] (0,0) -- (80,0) node[below] {$x$};
      \draw[->] (0,0) -- (0,70) node[left] {$y$};

      \foreach \p in {(1,11),(5,40),(10,20),(20,18),(20,41),(33,15),(39,22),(60,50),(68,19)} {
        \node[point] (\arabic{i}) at \p {};
        \stepcounter{i}
      }

      \foreach \p in {(21,10),(48,9),(55,17)} {
        \node[point, fill=red] (\arabic{i}) at \p {};
        \stepcounter{i}
      }

      \draw[blue] (1) -- (9);
    \end{tikzpicture}
    \caption{Lower List}
    \label{fig:rtp:lower}
  \end{minipage}\hfill
  \begin{minipage}[t]{0.4\textwidth}
    \begin{tikzpicture}[yscale=0.05,xscale=0.05]
      \setcounter{i}{1}

      \draw[->] (0,0) -- (80,0) node[below] {$x$};
      \draw[->] (0,0) -- (0,70) node[left] {$y$};

      \foreach \p in {(1,11),(21,10),(48,9),(55,17),(68,19)} {
        \node[point] (\arabic{i}) at \p {};
        \stepcounter{i}
      }

      \foreach \p in {(5,40),(10,20),(20,18),(20,41),(33,15),(39,22),(60,50)} {
        \node[point, fill=red] (\arabic{i}) at \p {};
        \stepcounter{i}
      }

      \draw[blue] (1) -- (5);
    \end{tikzpicture}
    \caption{Upper list}
    \label{fig:rtp:upper}
  \end{minipage}
\end{figure}

\begin{figure}[ht]
  \centering

  \begin{minipage}[t]{0.4\textwidth}
    \begin{tikzpicture}[yscale=0.05,xscale=0.05]
      \setcounter{i}{1}

      \draw[->] (0,0) -- (80,0) node[below] {$x$};
      \draw[->] (0,0) -- (0,70) node[left] {$y$};

      \foreach \p in {(1,11),(5,40),(10,20),(21,10),(20,18),(20,41),(33,15),(39,22),(48,9),(55,17),(60,50),(68,19)} {
        \node[point] (\arabic{i}) at \p {};
        \stepcounter{i}
      }
      \draw (1) -- (2) -- (3) -- (5) -- (6) -- (7) -- (8) -- (11) -- (12);
    \end{tikzpicture}
    \caption{The Upper polygon}
    \label{fig:rtp:polygon-upper}
  \end{minipage}\hfill
  \begin{minipage}[t]{0.4\textwidth}
    \begin{tikzpicture}[yscale=0.05,xscale=0.05]
      \setcounter{i}{1}

      \draw[->] (0,0) -- (80,0) node[below] {$x$};
      \draw[->] (0,0) -- (0,70) node[left] {$y$};

      \foreach \p in {(1,11),(5,40),(10,20),(21,10),(20,18),(20,41),(33,15),(39,22),(48,9),(55,17),(60,50),(68,19)} {
        \node[point] (\arabic{i}) at \p {};
        \stepcounter{i}
      }

      \draw (1) -- (2) -- (3) -- (5) -- (6) -- (7) -- (8) -- (11) -- (12) -- (10) -- (9) -- (4) -- (1);
    \end{tikzpicture}
    \caption{Final polygon}
    \label{fig:rtp:polygon}
  \end{minipage}
\end{figure}

\FloatBarrier


\newpage
\section{Proposed solution} \label{solution}

In this section we propose the approaches with centralized coordination.
In a warehouse the connection between robots is efficient and has no big limitations.
\begin{enumerate}
  \item The first strategy, mentioned above, is the \srst which consider only
  one task allocated for one robot.

  \item The second strategy \sps using an optimal approach
  to compose tasks. Precisely resolve the set partition problem of set tasks $\mathcal{T}$ .

  \item The last strategy (\gsp) extends the first algorithm,
  the main concept of this strategy is composing the tasks in a single travel with greedy coalition formation approach.

\end{enumerate}

In section \ref{chap:conclusions} as a future development we want to explore a distributed
method because in this thesis we  only focused in centralized method.

\subsection{Single robot : Single task (\srst)}

This method is a baseline for our logistic scenario.
The important constraint of this approach is to consider only one task allocated for
one robot at time.
\\
The set of tasks is ordered by the function mentioned below.
\begin{algorithm}
  \caption{Pop minimum element} \label{SP}
  \begin{algorithmic}[1]

    \Procedure{PME}{$T_i, T_j \in \mathcal{T}$}
    \If{$(demand(T_i) < demand(T_j)) \wedge (dst(T_i) < dst(T_j))$}
    \State {\bf return} true
    \Else
    \If{$dst(T_i) = dst(T_j)$}
    \State {\bf return} true
    \EndIf
    \State {\bf return} false
    \EndIf
    \EndProcedure
  \end{algorithmic}
\end{algorithm}
\newpage
Such function sorts the tasks based on the distance of the unloading bays and the demand of a specific task.
For distance we consider the euclidean distance between loading bay $L$ and unloading bays $U_j$.
Instead for demand is the weight of the item.

After the choose of the task to allocate by using the function $f(P)$ return the path distance, precisely the cost of the trail.

For this method we do not use the function $p(\cdot)$ because we have only one task for robot
then the task already has the path. As mentioned above, we do not combine routes.

For completeness in this method we do not consider the heuristic function $v(\cdot)$ because the demand for all
task is always 1. Because we allocate only one task for one robot at time.

This algorithm take linear time or $O(n)$ time, its time complexity is $O(n)$.
This means that the running time increases at most linearly with the size of the input.
More precisely, this means that there is a constant $c$ such that the running time is
at most $cn$ for every input of size $n$.

\begin{figure} [hbt]
  \centering
  \includegraphics[width=\textwidth]{img/cycle1.png}
  \caption{Example of execution \srst with 4 agents with capacity 4 and 9 tasks.}
  \label{fig:srst}
\end{figure}

\subsection{Set Partition Strategy - Single robot : Multiple task (\sps)}

This method consists to compute all possible patitions of the task set
using Set Partition algorithm \cite{partition} and use only
the best partition which is based on the previously mentioned heuristic $v(\cdot)$.

After initialzation phase which all agents send their capacity and identifier,
start the partition algorithm \cite{partition} that return all possible patitions of subsets combination
of tasks $P^N$.

Then foreach partitions the heuristic $v(\cdot)$ has been used to calculate the loss.
For calculate the loss $L$ of a partition we have to calculate the $v(\cdot)$ for all elements in
the subsets partition and finally sum all values for all subsets.
Furthermore the combination with the lowest loss has been choose.
So a subset of combination as been sort in a increasing order.
Then the first subset of combination has the lowest value of heuristic function
is the first task assigned at the first request from a robot.

\begin{algorithm}
  \caption{Set Partition Strategy} \label{SP}
  \begin{algorithmic}[1]
  \Procedure{SPS}{$P^N$}\Comment{$P^N$= \texttt{partition(}$\mathcal{T}$\texttt{)}}
  \State \Comment{define $C$ the maximum capacity of the robots}
  \For{$P_i \in P^N$}
  \If{$demand(P_i) > C$}
  $P^N \setminus P_i$
  \EndIf
    \For{$S_j \in P_i$}
      $v(S_j)$
    \EndFor
  \EndFor
  \Comment{sort all $P_i$ for lowest $v(\cdot)$}
  \State {\bf return} the first $P_i$
  \EndProcedure
  \end{algorithmic}
\end{algorithm}

The function \texttt{partition($\cdot$)} take exponential time.

More formally, this algorithm is exponential time because $T(n)$ is bounded by $O(2^{n^{k}})$
for some constant $k$.

\newpage

An example of solution with set $|\mathcal{T}| = 4$:
\begin{center}
  \begin{tabular}{|c|r|c|} \hline
  \textbf{iteration} & \textbf{partition size} & \textbf{partition} \\ \hline
  1    & 1    & \{\{a, b, c, d\}\}   \\
  2    & 2    & \{\{a, b, c\}, \{d\}\}   \\
  3    & 2    & \{\{a, b, d\}, \{c\}\}   \\
  4    & 2    & \{\{a, b\}, \{c, d\}\}   \\
  5    & 3    & \{\{a, b\}, \{c\}, \{d\}\}   \\
  6    & 2    & \{\{a, c, d\}, \{b\}\}   \\
  7    & 2    & \{\{a, c\}, \{b, d\}\}   \\
  8    & 3    & \{\{a, c\}, \{b\},\{d\}\}   \\
  9    & 2    & \{\{a, d\}, \{b, c\}\}   \\
  10   & 2    & \{\{a\}, \{b, c, d\}\}   \\
  11   & 3    & \{\{a\}, \{b, c\}, \{d\}\}   \\
  12   & 3    & \{\{a, d\}, \{b\}, \{c\}\}   \\
  13   & 3    & \{\{a\}, \{b, d\}, \{c\}\}   \\
  14   & 3    & \{\{a\}, \{b\}, \{c, d\}\}   \\
  15   & 4    & \{\{a\}, \{b\}, \{c\},\{d\}\}   \\ \hline
  \end{tabular}
\end{center}

For $|\mathcal{T}| = 4$ takes 0.000043 seconds. If we increase the set, time increases exponentially.
An example of $|\mathcal{T}| = 12$ takes 2.8 seconds and $|\mathcal{T}| = 13$ takes 21.2 seconds.

For this reason in our experiment we limited the size of the task set at most 9 tasks.

\begin{figure} [hbt]
  \centering
  \includegraphics[width=\textwidth]{img/opt.png}
  \caption{Example of execution \sps with 4 agents with capacity 4 and 9 tasks. See example \ref{example}}
  \label{fig:srst}
\end{figure}

\subsection{Greedy Set Partition Strategy - Single robot : Multiple task (\gsp)}
The main concept of this approach is composing tasks using Greedy Coalition Formation
based on \cite{cf_greedy} and \cite{cf_farinelli}. Where one wants to minimize the
team cost subject to the constraint that each task must be executed by a given
number of cooperative agents simultaneosly. Each task requires a number of different
demands, and each coalition for the task needs to provide the requered capabilities.

Later initialzation phase which all agents send their capacity and identifier,
start the Coalition Formation algorithm \cite{cf_greedy}.
When compute new one possible coalition the heuristic  $v(\cdot)$ has been used to calculate
the loss $L(T_{i,j})$ and if is negative that coalition is insered into the formation and the
$T_i$ , $T_j$ are deleted from the task set $\mathcal{T}$.

\begin{algorithm}
\caption{Greedy Coalition Formation} \label{GCF}
\begin{algorithmic}[1]
  \Procedure{GCF}{$\mathcal{T}$}\Comment{$\mathcal{T}$ = set of tasks}
  \State \Comment{define $C$ the maximum capacity of the robots}
  \For{$T_i \in \mathcal{T}$}
  \For{$T_j \in \mathcal{T}$}
\Comment{define $T_{i,j} = T_i \cup T_j$}
\If{$(T_i \neq T_j) \wedge (demand(T_{i,j}) \leq C)$}
\If{$v(T_{i,j})-v(T_i)-v(T_j) < 0$}
       \State $\mathcal{T} \setminus \{ T_i\} \setminus \{T_j\}$ $\mathcal{T} \cup \{T_{i,j}\}$
  \EndIf
  \EndIf
\EndFor
\EndFor
\State {\bf return} $\mathcal{T}$
\EndProcedure
\end{algorithmic}
\end{algorithm}

This algorithm take polynomial time, its running time is upper bounded by a polynomial expression
in the size of the input for the algorithm.

More precisely, this algorithm take $O(n^k)$ for some positive constant $k$.

\begin{figure} [hbt]
  \centering
  \includegraphics[width=\textwidth]{img/cf.png}
  \caption{Example of execution \gsp with 4 agents with capacity 4 and 9 tasks. See example \ref{example}}
  \label{fig:srst}
\end{figure}

\newpage
\subsection*{Example with 9 tasks and 4 robots} \label{example}
Given a set of tasks $\mathcal{T}= \{  \{T_0\}, \{T_1\}, \cdots, \{T_8\} \}$ defined like:

${T_i=(item, demand, unloading\_bay)}$.

The agents have the same capacity $C_{0,1,2,3} = 4$.
\begin{table}[hbt]
\begin{center}
  % \centering
  \begin{tabular}{|c|c|c|c|} \hline
    \textbf{task} & \textbf{item} & \textbf{demand} & \textbf{unloading bay} \\ \hline
    0    & A    & 1      & 0             \\
    1    & B    & 2      & 1             \\
    2    & C    & 3      & 2             \\
    3    & A    & 1      & 0             \\
    4    & B    & 2      & 1             \\
    5    & C    & 3      & 2             \\
    6    & A    & 1      & 0             \\
    7    & B    & 2      & 1             \\
    8    & C    & 3      & 2             \\ \hline
  \end{tabular}
  \caption{The task set $\mathcal{T}$ for 9 tasks}
  \label{tab:t4}
\end{center}
\end{table}

Given a finite task set $\mathcal{T}$ we can see how our strategies works.
For this example we have created a video of the simulations execution, in ROS and stage, which are available on YouTube \footnote{YouTube site https://youtu.be/XbdBklu98HE}.
\newpage
The \sps created 5 orders to perform all elements in the tasks set.

In the table \ref{tab:sps} we can see the partition composed by subsets of tasks.
\begin{table}[hbt]
  \begin{center}
    \begin{tabular}{|c|c|c|c|} \hline
    \textbf{task} & \textbf{item} & \textbf{demand} & \textbf{unloading bay} \\ \hline
    \{4,7\}    & B    & 4     & \{1\}             \\
    \{0,1,3\}  & \{A,B\}& 4    & \{0,1\}             \\
    \{2,6\}    & \{C,A\}    & 4  & \{0,2\}             \\
    5    & C    & 3      & 2             \\
    8    & C    & 3      & 2             \\ \hline
    \end{tabular}
    \caption{The result of the Set Partition Strategy (\sps)}
    \label{tab:sps}
  \end{center}
\end{table}

The \gsp creted 6 orders, one more than \sps, to perform all elements in the tasks set.

In table \ref{tab:gsp} we can see the partition composed by subsets of tasks.
\begin{table}[hbt]
\begin{center}
  \begin{tabular}{|c|c|c|c|} \hline
  \textbf{task} & \textbf{item} & \textbf{demand} & \textbf{unloading bay} \\ \hline
  \{3,2\}    & \{A,C\}    & 4     & \{0,2\}             \\
  \{0,1\}    & \{A,B\}    & 3     & \{0,1\}             \\
  \{6,4\}    & \{A,B\}    & 3     & \{0,1\}             \\
  5    & C    & 3      & 2             \\
  8    & C    & 3      & 2             \\
  7    & B    & 2      & 1             \\\hline
  \end{tabular}
  \caption{The result of the Greedy Set Partition (\gsp)}
  \label{tab:gsp}
\end{center}
\end{table}

\newpage
In this Figure \ref{fig:CF_graph} we can see because the Greedy approach is less
complex than \sps. On the execution before to create a coalition is checked if its can
be allocated. This check is the value of the loss of the coalition, if is less than zero
the colaition is insered in the solution else break the cycle for and pass another coalition.

\begin{figure} [hbt]
    \centering
    \includegraphics[width=\textwidth]{img/CF.png}
    \caption{The horizontal line represents a cut on executin defines the coalition structure.}
    \label{fig:CF_graph}
\end{figure}