\chapter{Exploration by Confidence}
\label{cha:expl-conf}

Recall that we have introduced GCIs with high confidence as an approach to extract
terminological knowledge from erroneous data.  For this approach we have seen in
\Cref{sec:comp-conf-bases} that the thus obtained GCIs require an additional validation
step, \ie an expert has to verify whether the extracted GCIs, whose confidence in the data
$\mathcal{I}$ is above a pre-chosen threshold $c \in [0,1]$, are indeed valid in the
domain of interest.

This additional validation step can be very costly, and thus it should be avoided as much
as possible.  On the other hand, we have also seen in \Cref{sec:comp-conf-bases} that as
soon as some GCI has been confirmed, others may be entailed by it, and a manual validation
is no longer necessary.  This observation may indeed save a lot of work.

Even more, utilizing this observation may save computation time as well: if during the
computation of bases of $\Th_c(\mathcal{I})$ an expert already rejects a GCI and confirms
that some counterexamples contained in $\mathcal{I}$ are indeed correct, then all GCIs
which are falsified by these counterexamples can also be rejected, irrespective of whether
their confidence in $\mathcal{I}$ is above $c$, or not.  It is thus desirable to allow
expert interaction already during the time of the computation of bases of
$\Th_c(\mathcal{I})$, and not only at the end of the computation, as a separate validation
step.

There is also another issue that requires expert interaction, and which has already been
addressed by Distel~\cite{Diss-Felix}: the data $\mathcal{I}$ may not only contain errors,
but it may also be \emph{incomplete} in the sense that it lacks certain counterexamples,
meaning that some GCIs are valid in $\mathcal{I}$, even so they are not valid in the
domain of interest.  If $\mathcal{I}$ contains errors, it may additionally happen that
some invalid GCIs $C \sqsubseteq D$ are only falsified in $\mathcal{I}$ by erroneous
counterexamples, and that correct counterexamples are not present in $\mathcal{I}$.  In
such a case, the GCI $C \sqsubseteq D$ would be accepted (since all counterexamples are
erroneous) although it is not valid.  Here an expert could, as soon as $C \sqsubseteq D$
would be computed as an element of a base, provide correct counterexamples, inhibiting
this GCI from being included in a base.  Such counterexamples would also affect the
following computation, as all GCIs invalidated by it would also be rejected.

The approach followed by Distel to solve this problem is to adapt attribute exploration
from its original setting of implications and formal contexts to the setting of GCIs and
finite interpretations.  Recall that the attribute exploration algorithm, which we had
discussed previously in \Cref{sec:attr-expl}, solves a problem which is very similar to
the one sketched above: given a finite formal context $\con K$, we want to compute a base
of the domain which is represented by $\con K$.  However, it may be the case that $\con K$
does not completely represent the domain we are interested in, \ie some implications which
are not valid in our domain actually hold in $\con K$.  Then attribute exploration
provides an interactive base computation procedure which, as soon as an implication is
computed, presents it to the expert and asks for validation.  If the expert confirms this
implication, then the implication is added to the base.  If the expert does not confirm
this implication, she has to provide a counterexample, which is then included in $\con K$.
At the end, the attribute exploration algorithm yields a base of the domain we are
interested in, and not only one for the formal context $\con K$.

Distel's generalizations of attribute exploration to the setting of GCIs and finite
interpretation are called \emph{model exploration} and \emph{ABox exploration}.  Their
abstract behavior is very similar to the one of attribute exploration: during the
computation of a base of $\mathcal{I}$, GCIs $C \sqsubseteq D$ are asked to the expert.
If confirmed, they are added to the base.  If rejected, the expert has to provide a
counterexample which is being added to $\mathcal{I}$.  Upon termination, the algorithm
yields a base of the domain which is represented by the expert.

Model exploration and ABox exploration differ in the way counterexamples are provided.  In
model exploration, counterexamples are directly added to the interpretation $\mathcal{I}$,
whereas in ABox exploration the counterexamples are being added to a separate ABox.  The
latter variant is much more user-friendly from the point of view of how to specify
counterexamples, but the resulting exploration algorithm is much more technical and
complicated.  Therefore, we shall concentrate in this work on model exploration only.

In the following two chapters we want to generalize model exploration to our setting of
extracting GCIs with high confidence from finite interpretations.  More precisely, what we
want to obtain is an algorithm that computes bases of $\Th_c(\mathcal{I})$, and, as soon
as a GCI for the base is computed, asks the expert for validation.  As above, the expert
may confirm or reject this GCI, where in the latter case she has to provide a
counterexample.  Upon termination, the algorithm should yield a base of the domain that
is represented by the expert, to the extent in which this domain is contained in
$\Th_c(\mathcal{I})$.  We shall make this more precise in \Cref{cha:model-expl-conf}.

The purpose of this chapter is to prepare this generalization of model exploration to GCIs
with high confidence by first discussing the analogous problem in the world of formal
concept analysis.  For this, we want to develop an algorithm for \emph{exploration by
  confidence}, which not only asks implications that are valid in the current working
context, but may just have a high confidence in the original data set.

To this end, we shall first consider in \Cref{sec:class-attr-expl} classical attribute
exploration from a more abstract point of view.  In this consideration, we shall see that
we can consider attribute exploration of a formal context $\con K$ as an algorithm that
\enquote{explores} the set $\Th(\con K)$, in the sense that attribute exploration tries to
find out which implications in $\Th(\con K)$ are confirmed by an expert and which not.  To
make this more precise, we shall also introduce a formalization of the up to now only
informally treated notion of an \emph{expert}.

Based on the observation that attribute exploration is an algorithm to explore $\Th(\con
K)$, we shall introduce in \Cref{sec:gener-attr-expl} a generalization of attribute
exploration that allows to explore arbitrary sets $\mathcal{L}$ of implications.  The main
idea is that this \emph{exploration of sets of implications} works in the same way as
attribute exploration, namely by asking implications from $\mathcal{L}$ to the expert to
try to find out which of the implications in $\mathcal{L}$ are accepted by the expert and
which not.  However, the algorithm we are going to present in \Cref{sec:gener-attr-expl}
will not completely achieve this goal, but instead will provide us with an
\emph{approximative exploration} of $\mathcal{L}$, a notion which we shall make clear
then.  Intuitively, this means that also implications which are not elements of
$\mathcal{L}$, but of $\Cn(\mathcal{L})$, can be asked to the expert, and thus may appear
in the output.  Still, we shall see in \Cref{sec:expl-conf} that this approximative
exploration is sufficient to allow us to obtain an algorithm for exploration by
confidence.  The main idea for this is to use the set $\mathcal{L} = \Th_{c}(\con K)$ as
the set we want to explore.  In this case we shall also see how the approximative
exploration provided by the general algorithm can be turned into a proper exploration, \ie
we can ensure in the special case of $\mathcal{L} = \Th_{c}(\con K)$ that all implications
asked to the expert indeed have high confidence in the original data set.

The results presented in this section have partially been published previously in
\cite{Borch-LTCS-13-04}.

\section{Exploring Sets of Implications}
\label{sec:an-abstract-view}

Let $M$ be a finite set and $\mathcal{L} \subseteq \Imp(M)$.  In this section we want to
discuss how we can turn attribute exploration into an algorithm for \emph{exploring
  $\mathcal{L}$}.  To this end, we shall first give another perspective on the attribute
exploration algorithm that we have already met in \Cref{sec:attr-expl}.  Based upon this,
we shall introduce in \Cref{sec:gener-attr-expl} a \emph{generalized attribute
  exploration} that allows us to explore $\mathcal{L}$.  This generalization is however
only approximative, in a sense that we shall make clear then.

\subsection{An Abstract View on Attribute Exploration}
\label{sec:class-attr-expl}

Recall that in attribute exploration as introduced in \Cref{sec:attr-expl} we assumed that
the domain of interest can be represented by a formal context $\con K_{\mathsf{back}}$,
which we call the \emph{background context} of the exploration.  The goal of attribute
exploration is then to find a base of $\con K_{\mathsf{back}}$, without having direct
access to $\con K_{\mathsf{back}}$.  For this we start with a subcontext $\con K = (G, M,
I)$ of $\con K_{\mathsf{back}}$, the \emph{working context} of the exploration, and a set
$\mathcal{K} \subseteq \Imp(M)$ of implications which are valid in $\con
K_{\mathsf{back}}$, called the set of \emph{known implications}.  Then we successively
compute implications of the form
\begin{equation*}
  P \to P''
\end{equation*}
where $P$ is a $\mathcal{K}$-pseudo intent of $\con K$, and in particular is closed under
the set of currently known implications, but is not an intent of the current working
context.  Those implications are presented to the expert, who either confirms or rejects
them.

We can view this procedure from a more general perspective:\footnote{This idea is similar
  to the one of considering the process of attribute exploration as a decreasing sequence
  of intervals in the lattice of closure systems over $M$, see~\cite[pp.\
  143--145]{GORS-book} for more details.} given the formal context $\con K$, we know that
all implications in $\Imp(M) \setminus \Th(\con K)$ \emph{are not} valid in $\con
K_{\mathsf{back}}$, and thus are not valid in our domain.  On the other hand, all
implications in $\Th(\con K)$ \emph{could} be valid in $\con K_{\mathsf{back}}$, depending
on whether counterexamples contained in $\con K_{\mathsf{back}}$ invalidate implications
being valid in $\con K$ or not.  However, what we are certain of is that all implications
in $\mathcal{K}$ \emph{are} valid in our domain, and thus all implications in
$\Cn(\mathcal{K})$ are.

Hence, we have the situation that we have three sets of implications, namely the set of
\emph{all} implications $\Imp(M)$, the set $\Th(\con K)$ of \emph{possibly valid}
implications, and the set of \emph{certainly valid} implications $\Cn(\mathcal{K})$.
These sets are related by
\begin{equation*}
  \Imp(M) \supseteq \Th(\con K) \supseteq \Cn(\mathcal{K}),
\end{equation*}
since $\mathcal{K}$ is supposed to be sound for $\con K$.  Now the set
\begin{equation*}
  \Th(\con K) \setminus \Cn(\mathcal{K})
\end{equation*}
can be seen as the set of \emph{undecided} implications, \ie the set of those implications
which are possibly valid in $\con K_{\mathsf{back}}$, but from which we do not know yet
whether they indeed are valid in $\con K_{\mathsf{back}}$ or not (since we do not have
direct access to $\con K_{\mathsf{back}}$).  Then attribute exploration can be viewed as a
\emph{systematic search} through the set $\Th(\con K) \setminus \Cn(\mathcal{K})$, in the
sense that the crucial feature for attribute exploration to work is to be able to compute
implications
\begin{equation}
  \label{eq:33}
  (P \to P'') \in \Th(\con K) \setminus \Cn(\mathcal{K}),
\end{equation}
provided that $\Th(\con K) \setminus \Cn(\mathcal{K}) \neq \emptyset$.  We shall argue now
why this is indeed enough.

Let $(P \to P'') \in \Th(\con K) \setminus \Cn(\mathcal{K})$.  Then the implication $P \to
P''$ is proposed to the expert.  If she accepts $P \to P''$, then we add this implication
to $\mathcal{K}$, and we obtain the following situation:
\begin{equation*}
  \Imp(M) \supseteq \Th(\con K) \supseteq \Cn(\mathcal{K} \cup \set{ P \to P'' })
  \supsetneq \Cn(\mathcal{K}).
\end{equation*}
If the expert rejects $P \to P''$, she has to provide a counterexample, \ie a set $C
\subseteq M$ such that $P \subseteq C$ and $P'' \not\subseteq C$.  Denote with $\con K +
C$ the formal context which arises from $\con K$ by adding a new object $g_C$ to $\con K$
which has exactly the attributes which are contained in $C$, \ie
\begin{equation*}
  (g_C)' := C
\end{equation*}
where the derivation is done in $\con K + C$.  Then the situation from above evolves into
\begin{equation*}
  \Imp(M) \supseteq \Th(\con K) \supsetneq \Th(\con K + C) \supseteq \Cn(\mathcal{K}).
\end{equation*}

If $\Th(\con K) \setminus \Cn(\mathcal{K}) = \emptyset$, then the algorithm terminates.
(Note that this indeed has to happen since the base set $M$ is finite.)  When this
happens, the situation can be described as follows\footnote{We read $\con K + C_1 + \dots
  + C_m$ as $(\dots(\con K + C_1) + \dots ) + C_m$ and nothing else.}:
\begin{align*}
  \Imp(M) &\supseteq \Th(\con K) \supsetneq \Th(\con K + C_1) \supsetneq \dots \supsetneq
  \Th(\con K + C_1 + \dots + C_m) \\ &= \Cn(\mathcal{K} \cup \set{ P_1 \to P_1'', \dots, P_n
    \to P_n'' }) \supsetneq \dots \supsetneq \Cn(\mathcal{K})
\end{align*}
where $m, n \in \NN_{\geq 0}$, $C_1, \dots, C_m, P_1, \dots, P_n \subseteq M$, and where
all derivations are done in $\con K + C_1 + \dots + C_m$.  It is then true that
\begin{equation*}
  \Th(\con K + C_1 + \dots + C_m) = \Th(\con K_{\mathsf{back}}) = \Cn(\mathcal{K} \cup
  \set{ P_1 \to P_1'', \dots, P_n \to P_n'' })
\end{equation*}
just because
\begin{equation*}
  \Th(\con K + C_1 + \dots + C_i) \supseteq \Th(\con K_{\mathsf{back}}) \supseteq
  \Cn(\mathcal{K} \cup \set{ P_1 \to P_1'', \dots, P_j \to P_j''} )
\end{equation*}
for all $1 \leq i \leq m$ and $1 \leq j \leq n$.  In particular, the set
\begin{equation*}
  \set{P_1 \to P_1'', \dots, P_n \to P_n''}
\end{equation*}
is a base of $\con K_{\mathsf{back}}$ with background knowledge $\mathcal{K}$, as
required.

Note that we did not require that the set $P$ from \Cref{eq:33} is a $\mathcal{K}$-pseudo
intent of $\con K$.  The only necessary requirement is that $P \neq P''$ and that $P \to
P''$ does not follow from $\mathcal{K}$.  Both these properties are guaranteed by $P$
being a $\mathcal{K}$-pseudo intent of $\con K$, but this is not necessary.

On the other hand, if we want to compute the canonical base of $\con K_{\mathsf{back}}$
with background knowledge $\mathcal{K}$, then $P$ obviously needs to be a
$\mathcal{K}$-pseudo intent of $\con K$.  However, since in our perception attribute
exploration should compute \emph{some} base of $\con K_{\mathsf{back}}$, we can see the
computation of $\Can(\con K_{\mathsf{back}}, \mathcal{K})$ as an optimization, and not as
a crucial requirement.

\subsection{A Generalized Attribute Exploration}
\label{sec:gener-attr-expl}

The foregone considerations suggest that we can view attribute exploration as an algorithm
that allows us to \enquote{explore} the set $\Th(\con K) \setminus \Cn(\mathcal{K})$ of
undecided implications.  In this section we want to generalize this view to the setting
where the set of undecided implications has a more general form.

To make this more precise, let $M$ be a finite set, $\mathcal{L} \subseteq \Imp(M)$ and
let $\mathcal{K} \subseteq \Cn(\mathcal{L})$.  As we have viewed the set $\Th(\con K)$ as
the set of possibly valid implications, we can now view the set $\mathcal{L}$ as the set
of possibly valid implications.  Then the set of undecided implications takes the form
\begin{equation*}
  \mathcal{L} \setminus \Cn(\mathcal{K})
\end{equation*}
and we want to obtain an algorithm that guides an expert in finding all valid implications
in $\mathcal{L} \setminus \Cn(\mathcal{K})$.  More precisely, we want to compute a base of
all implications valid in $\mathcal{L}$, using $\mathcal{K}$ as background knowledge.  As
before, we assume that we do not have direct access to the background context $\con
K_{\mathsf{back}}$, the formal context that is represented by the expert.

At first sight, one may be tempted to say that exploring $\mathcal{L}$ can be achieved (at
least in theory) by considering the formal context
\begin{equation*}
  \con K_{\mathcal{L}} = (\set{ \mathcal{L}(X) \mid X \subseteq M }, M, \ni)
\end{equation*}
which already appeared in \Cref{prop:context-model-for-implications}.  This proposition
tells us that $\Th(\con K_{\mathcal{L}}) = \Cn(\mathcal{L})$, and thus one could propose
that for exploring $\mathcal{L}$ it would just be sufficient to explore $\con
K_{\mathcal{L}}$.  However, besides the fact that computing $\con K_{\mathcal{L}}$ (or a
subcontext of it which still has $\Cn(\mathcal{L})$ as its theory) is far from practical,
this approach also does not solve our initial problem, because in general $\mathcal{L} =
\Cn(\mathcal{L})$ does not hold.  This is illustrated by the following example.

\begin{Example}
  \label{expl:why-exploring-implications-is-different}
  Let $M = \set{ \mathsf{a}, \mathsf{b}, \mathsf{c} }, \mathcal{K} = \emptyset,
  \mathcal{L} = \set{ \set{ \mathsf{a} } \to \set{ \mathsf{b} } }$ and suppose that our
  domain can be represented by the formal context
  \begin{equation*}
    \begin{array}{c|ccc}
      \toprule
      \con K_{\mathsf{back}} & \mathsf{a} & \mathsf{b} & \mathsf{c} \\
      \midrule
      g & \times \\
      \bottomrule
    \end{array}
  \end{equation*}
  Then clearly $\Th(\con K_{\mathsf{back}}) \cap \mathcal{L} = \emptyset$, and thus all
  bases of this set contain trivial implications (\ie implications of the form $P \to P$
  for $P \subseteq M$).  On the other hand,
  \begin{equation*}
    (\set{ \mathsf{a}, \mathsf{c} } \to \set{ \mathsf{b} }) \in
    \Cn(\mathcal{L}) \cap \Th(\con K_{\mathsf{back}}),
  \end{equation*}
  and therefore bases of $\Th(\con K_{\mathsf{back}}) \cap \Cn(\mathcal{L})$ contain
  non-trivial implications.

  Thus, exploring $\mathcal{L}$ and exploring $\Cn(\mathcal{L})$, using the aforementioned
  expert and $\mathcal{K}$ as background knowledge, are different tasks.
\end{Example}

Intuitively, an algorithm for exploring $\mathcal{L}$ should work as attribute exploration
does: if the implication $P \to Q$ is accepted by the expert, then it is added to
$\mathcal{K}$.  If it is rejected by the expert, then a counterexample $C$ has to be
provided by the expert.  In this case, all implications from $\mathcal{L}$ for which $C$
is a counterexample are removed.  The algorithm terminates if $\mathcal{L} \setminus
\Cn(\mathcal{K}) = \emptyset$ (in which case also $\Cn(\mathcal{L}) \setminus
\Cn(\mathcal{K}) = \emptyset$ holds).

In what follows, we want to make this idea more precise.  To this end, we shall first
start with a formalization of the notion of an \emph{expert} that we heretofore have used
only intuitively.

\begin{Definition}[Domain Expert]
  \label{def:domain-expert}
  Let $M$ be a set.  A \emph{domain expert} on $M$ is a function
  \begin{equation*}
    p \colon \Imp(M) \to \set{ \top } \cup \subsets{M},
  \end{equation*}
  where $\top \notin \subsets M$, and which satisfies the following conditions
  \begin{enumerate}[i. ]
  \item if $(X \to Y) \in \Imp(M)$ such that $p(X \to Y) = C \neq \top$, then $ X
    \subseteq C$ and $Y \not\subseteq C$, (\emph{$p$ gives counterexamples for false
      implications})
  \item if $(U \to V), (X \to Y) \in \Imp(M)$ such that $p(U \to V) = \top, p(X \to Y) = C
    \neq \top$, then $C$ is not a counterexample for $U \to V$, \ie either $U
    \not\subseteq C$ or $V \subseteq C$. (\emph{counterexamples from $p$ do not invalidate
      confirmed implications})
  \end{enumerate}
  We say that $p$ \emph{confirms} $(X \to Y) \in \Imp(M)$ if and only if $p(X \to Y) =
  \top$.  Otherwise, we say that $p$ \emph{rejects} $X \to Y$ and \emph{provides $C = p(X
    \to Y)$ as a counterexample}.  Finally, the \emph{theory} $\Th(p)$ of $p$ is the set
  of all implications over $M$ which are confirmed by $p$.
\end{Definition}

We have not specified the notion of a \emph{domain} formally, but instead required that
every domain is representable by a formal context.  With our formalization of an expert we
can now show that experts provide an equally good approach to formalize the notion of a
domain as formal contexts do.

\begin{Proposition}
  \label{prop:domain-expert-from-domain}
  Let $\con K = (G, M, I)$ be a formal context.  For each $(A \to B) \in \Imp(M) \setminus
  \Th(\con K)$ let $g_{A \to B} \in G$ such that $A \subseteq g_{A \to B}'$ and $B
  \not\subseteq g_{A \to B}'$.  Then the mapping $p_{\con K} \colon \Imp(M) \to \set{ \top
  } \cup \subsets M$ defined by
  \begin{equation*}
    p_{\con K}(X \to Y) :=
    \begin{cases}
      g_{X \to Y} & (X \to Y) \notin \Th(\con K) \\
      \top & \text{otherwise}
    \end{cases}
  \end{equation*}
  is a domain expert on $M$, and $\Th(\con K) = \Th(p_{\con K})$.
\end{Proposition}
\begin{Proof}
  Clearly, if $(X \to Y) \notin \Th(\con K)$, then $p_{\con K}(X \to Y) = g_{X \to Y}$ is
  a counterexample for $X \to Y$.  If $(X \to Y) \in \Th(\con K)$, then for all $g \in G$
  it is true that either $X \not\subseteq g'$ or $Y \subseteq g'$.  Thus, no
  counterexample provided by $p_{\con K}$ is a counterexample for $X \to Y$.  Therefore,
  counterexamples provided by $p$ do not invalidate confirmed implications.  The equality
  $\Th(\con K) = \Th(p_{\con K})$ is clear from the definition of $p_{\con K}$.
\end{Proof}

Note that the actual definition of $p_{\con K}$ depends on the particular choice of the
objects $g_{A \to B}$, and thus $\con K$ can give rise to more than one domain expert.

If we have given a domain expert, we can easily construct a formal context from it that
has the same theory.

\begin{Proposition}
  \label{prop:domain-from-domain-expert}
  Let $p$ be domain expert on a set $M$.  Then the formal context $\con K_p = (G, M, \ni)$,
  where
  \begin{equation*}
    G := \set{ p(X \to Y) \mid (X \to Y) \in \Imp(M) \setminus \Th(p) }
  \end{equation*}
  satisfies $\Th(p) = \Th(\con K_p)$.
\end{Proposition}
\begin{Proof}
  If $(A \to B) \in \Th(p)$, then no counterexample provided by $p$ invalidates $A \to
  B$.  Since the rows of $\con K_p$ consist of the counterexamples provided by $p$, $\con
  K_p$ does not contain a counterexample for $A \to B$ and thus $(A \to B) \in \Th(\con
  K_p)$.

  If $p(A \to B) \notin \Th(p)$, then $p(A \to B) \subseteq M$ is a counterexample for $A
  \to B$ and therefore $(A \to B) \notin \Th(\con K_p)$.
\end{Proof}

In particular, for every domain expert $p$ on $M$ and every formal context $\con K = (G,
M, I)$ it is true that
\begin{align*}
  \Th(p) &= \Th(p_{\con K_p}), \\
  \Th(\con K) &= \Th(\con K_{p_{\con K}}).
\end{align*}
In other words, the representation of domains as formal contexts and in terms of domain
experts is, from a logical point of view, interchangeable.

With the formal notion of an expert we can reformulate our goal of exploring sets of
implications.

\begin{Definition}[Exploring Sets of Implications]
  \label{def:exploring-sets-of-implications}
  Let $M$ be a finite set, $p$ a domain expert on $M$, $\mathcal{L} \subseteq \Imp(M)$ and
  $\mathcal{K} \subseteq \Th(p) \cap \Cn(\mathcal{L})$.  Then to \emph{explore
    $\mathcal{L}$ with expert $p$ and background knowledge $\mathcal{K}$} means to compute
  a base of
  \begin{equation*}
    \mathcal{L} \cap \Th(p)
  \end{equation*}
  with background knowledge $\mathcal{K}$.
\end{Definition}

As an approach to find an algorithm that allows us to explore $\mathcal{L}$, we want to
suitably adapt the classical attribute exploration algorithm.  To this end, we shall first
consider a slight reformulation of the attribute exploration algorithm as given in
\Cref{alg:attribute-exploration}, and then try to adapt it to our setting of exploring
$\mathcal{L}$.

\addfunctionname{next-closed-non-closed}

\begin{figure}[tp]
  \begin{Algorithm}[Another Implementation of Attribute Exploration]
  \label{alg:explore-attributes-with-next-closed-none-closed}
  \hspace*{0cm}
\begin{lstlisting}
define next-closed-non-closed($M$, $\leq_M$, $A$, $\mathcal{K} \subseteq \Imp(M)$, $\mathcal{L} \subseteq \Imp(M)$)
  ;; computes the lectically smallest element greater or equal to $A$ that is closed
  ;; under $\mathcal{K}$ and not closed under $\mathcal{L}$

  if $A$ = nil then
    return nil
  else if $A = \mathcal{K}(A)$ and $A \neq \mathcal{L}(A)$ then
    return $A$
  else
    return next-closed-non-closed($M$, $\leq_M$, next-closure($M$, $\leq_M$, $A$, $\mathcal{K}$), $\mathcal{K}$, $\mathcal{L}$)
  end
end

define explore-attributes($M$, $\leq_M$, $p$, $\con K = (G, M, I)$, $\mathcal{K} \subseteq
\Th(p)$)
  $i$ := 0, $\con K_i$ := $\con K$, $\mathcal{K}_i$ := $\mathcal{K}$, $P_i$ := $\emptyset$

  forever do
    $P_{i+1}$ := next-closed-non-closed($M$, $\leq_M$, $P_i$, $\mathcal{K}_i$, $(.)_{\con K_i}''$)
    if $P_{i+1} =$ nil exit

    if $p(P_{i+1} \to (P_{i+1})_{\con K_i}'') = \top$ then
      $\mathcal{K}_{i+1}$ := $\mathcal{K}_i \cup \set{ P_{i+1} \to (P_{i+1})_{\con K_i}'' }$
      $\con K_{i+1}$ := $\con K_i$
    else
      $\mathcal{K}_{i+1}$ := $\mathcal{K}_i$
      $C$ := $p(P_{i+1} \to (P_{i+1})_{\con K_i}'')$
      $\con K_{i+1}$ := $\con K_i + C$
    end

    $i$ := $i + 1$
  end

  return $\mathcal{K}_i$
end
\end{lstlisting}
  \end{Algorithm}
\end{figure}

Recall that in \Cref{alg:attribute-exploration} we have used two special functions, namely
for computing the lectically first closed set that is not an intent of a given formal
context, and for computing the lectically next closed set of a given closure operator that
is not an intent of the current working context.  However, a closer inspection of the way
these functions are used reveals that attribute exploration can be reformulated using only
a function that computes for a given set $A \subseteq M$ the lectically smallest set
lectically greater \emph{or equal} to $A$ that is not an intent of the current working
context but is closed under a given closure operator.  An implementation of this function,
called \lstinline{next-closed-non-closed}, is given in
\Cref{alg:explore-attributes-with-next-closed-none-closed}.  This function suffices to
implement attribute exploration, and the corresponding listing is also shown in
\Cref{alg:explore-attributes-with-next-closed-none-closed}.

We want to use this reformulation as a starting point to discuss an algorithm for
exploring $\mathcal{L}$.  To this end, recall how we have considered attribute exploration
in \Cref{sec:class-attr-expl} as an algorithm for exploring $\Th(\con K)$.  Then in
iteration $i$ of the attribute exploration algorithm, the set of possibly valid
implications is given by $\Th(\con K_{i})$, where
\begin{equation*}
  \con K_{i} = \con K + C_{1} + \dots + C_{k_{i}}
\end{equation*}
for some $k_{i} \in \NN, C_{1}, \dots, C_{k_{i}} \subseteq M$.  The idea is now that in
\Cref{alg:explore-attributes-with-next-closed-none-closed} we replace every reference to
$\Th(\con K_{i})$ by a reference to a set $\mathcal{L}_{i}$ of implications.  For this we
observe that if a counterexample $C \subseteq M$ is given by the expert in iteration $i$,
then
\begin{align*}
  \Th(\con K_{i+1})
  &= \Th(\con K_{i} + C) \\
  &= \set{ (A \to B) \in \Th(\con K_{i}) \mid A \not\subseteq C \text{ or } B \subseteq C }.
\end{align*}
Correspondingly, we obtain
\begin{align*}
  \mathcal{L}_{i+1}
  &= \set{ (A \to B) \in \mathcal{L}_{i} \mid A \not\subseteq C \text{ or } B \subseteq C }.
\end{align*}
The result of this simple replacement is shown in \Cref{alg:explore-implications}.

\addfunctionname{explore-implications}

\begin{figure}[tp]
  \centering
  \begin{Algorithm}[Exploration of Sets of Implications]
    \label{alg:explore-implications}
    \hspace*{0cm}
\begin{lstlisting}
define explore-implications($M$, $\leq_M$, $p$, $\mathcal{L} \subseteq \Imp(M)$, $\mathcal{K} \subseteq \Th(p)$)
  $i$ := 0, $\mathcal{L}_i$ := $\mathcal{L}$, $\mathcal{K}_i$ := $\mathcal{K}$, $P_i$ := $\emptyset$

  forever do
    $P_{i+1}$ := next-closed-non-closed($M$, $\leq_M$, $P_i$, $\mathcal{K}_i$, $\mathcal{L}_i$)
    if $P_{i+1} =$ nil exit

    if $p(P_{i+1} \to \mathcal{L}_i(P_{i+1})) = \top$ then
      $\mathcal{K}_{i+1}$ := $\mathcal{K}_i \cup \set{ P_{i+1} \to \mathcal{L}_i(P_{i+1}) }$
      $\mathcal{L}_{i+1}$ := $\mathcal{L}_i$
    else
      $\mathcal{K}_{i+1}$ := $\mathcal{K}_i$
      $C$ := $p(P_{i+1} \to \mathcal{L}_i(P_{i+1}))$
      $\mathcal{L}_{i+1}$ := $\set{ (A \to B) \in \mathcal{L}_i \mid A \not\subseteq C
\text{ or } B \subseteq C }\label{lst:explore-implications-1}$
    end

    $i$ := $i + 1$
  end

  return $\mathcal{K}_i$
end
\end{lstlisting}
  \end{Algorithm}
\end{figure}

However, \Cref{alg:explore-implications} does not exactly yield an algorithm to explore
$\mathcal{L}$, using $p$ as domain expert and $\mathcal{K}$ as background knowledge.
Indeed, it may be the case that the set $\mathcal{K}_{n}$ of implications returned by
\Cref{alg:explore-implications} contains too many implications, \ie it may happen that
\begin{equation*}
  \Cn(\mathcal{K}_{n}) \setminus \Cn(\Th(p) \cap \mathcal{L}) \neq \emptyset.
\end{equation*}
This is illustrated by the following example\footnote{This example has been provided by an
  anonymous reviewer, who also pointed our an error in the original argumentation (as
  given in~\cite{Borch-LTCS-13-04}).}

\begin{Example}
  \label{expl:exploring-sets-of-implications-may-be-approximative}
  Let $M = \set{ \mathsf{a}, \mathsf{b}, \mathsf{c} }$, $a \leq_{M} b \leq_{M} c$, and
  define an expert $p$ on $M$ by $\Th(p) = \Cn(\set{ \mathsf{c} } \to \set{ \mathsf{a},
    \mathsf{b} })$.  Define furthermore $\mathcal{L} = \set{ \set{ \mathsf{a} } \to \set{
      \mathsf{b} }, \set{ \mathsf{c} } \to \set{ \mathsf{a} } }$.  Then the implication
  \begin{equation*}
    \set{ \mathsf{c} } \to \set{ \mathsf{a}, \mathsf{b} },
  \end{equation*}
  is proposed to the expert $p$, who confirms it.  Thus, this implication is an element of
  $\mathcal{K}_{n}$, but is not contained in $\Th(p) \cap \mathcal{L}$.
\end{Example}

However, we shall show that \Cref{alg:explore-implications} \emph{approximately explores}
$\mathcal{L}$, in the sense that the set $\mathcal{K}_{n}$ satisfies
\begin{equation}
  \label{eq:61}
  \Cn(\mathcal{L}) \cap \Th(p) \supseteq \Cn(\mathcal{K}_{n}) \supseteq \Cn(\Th(p) \cap \mathcal{L}).
\end{equation}
In other words, the resulting set of confirmed implications will at least be complete for
$\Cn(\Th(p) \cap \mathcal{L})$, and the implications which are not entailed by $\Th(p)
\cap \mathcal{L}$ are at least entailed by $\Cn(\mathcal{L}) \cap \Th(p)$.  It will turn
out that this is indeed sufficient for our considerations of finding an algorithm for
exploration by confidence, as we shall see in \Cref{sec:poss-fast-expl}.

It is the purpose of the following argumentation to show that
\Cref{alg:explore-implications} approximately explores $\mathcal{L}$ as described above.
For this we need to argue that the algorithm always terminates and, upon termination,
\Cref{eq:61} is satisfied.

\begin{Proposition}
  \label{prop:technicalities-about-explore-implications}
  Let $M$ be a finite set, $p$ a domain expert on $M$, $\mathcal{L} \subseteq \Imp(M)$ and
  $\mathcal{K} \subseteq \Th(p)$.  Then for iteration $i$ of the run of
  \lstinline{explore-implications} with this input, it is true that $\mathcal{K}_i
  \subseteq \mathcal{K}_{i+1}$ and $\mathcal{L}_i \supseteq \mathcal{L}_{i+1}$, and
  exactly one of these inclusions is strict.
\end{Proposition}
\begin{Proof}
  Suppose that we are in iteration $i$.  Then clearly $\mathcal{K}_i \subseteq
  \mathcal{K}_{i+1}$ and $\mathcal{L}_i \supseteq \mathcal{L}_{i+1}$ from the very
  definition of these sets.  Then, if $p$ confirms $P_{i+1} \to \mathcal{L}_i(P_{i+1})$,
  then $\mathcal{K}_i \subsetneq \mathcal{K}_{i+1}$ and $\mathcal{L}_i =
  \mathcal{L}_{i+1}$.  If $p$ rejects $P_{i+1} \to \mathcal{L}_i(P_{i+1})$, and $C =
  p(P_{i+1} \to \mathcal{L}_i(P_{i+1}))$, then there must exist at least one implication
  $(A \to B) \in \mathcal{L}_i$ such that $A \subseteq C$ and $B \not\subseteq C$, for
  otherwise $C$ cannot be a counterexample for $P_{i+1} \to \mathcal{L}_i(P_{i+1})$.
  Therefore, $\mathcal{L}_i \supsetneq \mathcal{L}_{i+1}$, and $\mathcal{K}_i =
  \mathcal{K}_{i+1}$ holds by definition.
\end{Proof}

\begin{Theorem}
  \label{thm:explore-implications-termination}
  Let $M$ be a finite set, $\leq_M$ a linear order on $M$, and let $p$ be a domain expert on
  $M$. Let $\mathcal{L} \subseteq \Imp(M)$ and $\mathcal{K} \subseteq \Th(p)$.  Then
  \lstinline{explore-implications} applied to these arguments terminates after finitely
  many steps.
\end{Theorem}
\begin{Proof}
  Note that \lstinline{explore-implications} has to terminate if $\Cn(\mathcal{L}_i)
  \setminus \Cn(\mathcal{K}_i) = \emptyset$.  By
  \Cref{prop:technicalities-about-explore-implications} we know that $\mathcal{K}_i
  \subseteq \mathcal{K}_{i+1}$ or $\mathcal{L}_i \supseteq \mathcal{L}_{i+1}$, and exactly
  one of these inclusions is strict.  The latter fact entails
  \begin{equation}
    \label{eq:36}
    \Cn(\mathcal{L}_{i+1}) \setminus \Cn(\mathcal{K}_{i+1}) \subsetneq \Cn(\mathcal{L}_i)
    \setminus \Cn(\mathcal{K}_i).
  \end{equation}
  This is because if $\mathcal{K}_i \neq \mathcal{K}_{i+1}$ then the implication $P_{i+1}
  \to \mathcal{L}_i(P_{i+1})$ added to $\mathcal{K}_{i}$ does not follow from
  $\mathcal{K}_i$, because $P_{i+1} = \mathcal{K}_{i}(P_{i+1})$.  Thus,
  $\Cn(\mathcal{K}_i) \subsetneq \Cn(\mathcal{K}_{i+1})$.  On the other hand, if
  $\mathcal{L}_i \neq \mathcal{L}_{i+1}$, then
  \begin{equation*}
    (P_{i+1} \to \mathcal{L}_i(P_{i+1})) \in \Cn(\mathcal{L}_i) \setminus \Cn(\mathcal{L}_{i+1})
  \end{equation*}
  and $\Cn(\mathcal{L}_i) \supsetneq \Cn(\mathcal{L}_{i+1})$.

  If the algorithm would run forever, it would thus yield an infinite descending chain
  \begin{equation*}
    \Cn(\mathcal{L}_0) \setminus \Cn(\mathcal{K}_0) \supsetneq \Cn(\mathcal{L}_1)
    \setminus \Cn(\mathcal{K}_1) \supsetneq \dots
  \end{equation*}
  Since $M$ is finite, $\subsets{\Imp(M)}$ is finite as well, and therefore this cannot
  happen.  Thus the algorithm has to terminate.
\end{Proof}

We now consider the correctness of \Cref{alg:explore-implications}.

\begin{Proposition}
  \label{prop:explore-implications-closedness-persists}
  Let $M$ be a finite set, $p$ a domain expert on $M$, and $\leq_M$ a linear order on
  $M$. Let $\mathcal{L} \subseteq \Imp(M)$ and $\mathcal{K} \subseteq \Th(p)$.  Denote
  with $\preceq$ the lectic order on $\subsets M$ induced by $\leq_M$.  Then in every
  iteration $i$ of the run of \lstinline{explore-implications} with this input such that
  $P_{i+1} \neq \text{\lstinline{nil}}$, it is true that for $A \prec P_{i+1}$, if $A$ is
  $\mathcal{K}_i$-closed, then $A$ is $\mathcal{L}_i$-closed as well.
\end{Proposition}
\begin{Proof}
  We show the claim by induction on $i$.  For the base case $i = 0$ the claim is vacuously
  true, since $P_1$, if not \lstinline{nil}, is the lectically smallest set which is
  $\mathcal{K}_0$-closed but not $\mathcal{L}_i$-closed.

  For the step case we assume that $P_{i+2} \neq \text{\lstinline{nil}}$.  We then need to
  show that for all $A \prec P_{i+2}$, if $A$ is $\mathcal{K}_{i+1}$-closed, then $A$ is
  also $\mathcal{L}_{i+1}$-closed.

  Thus let $A \prec P_{i+2}$ and $A$ be $\mathcal{K}_{i+1}$-closed.  Let us first consider
  the case $A \prec P_{i+1}$.  Since $\mathcal{K}_i \subseteq \mathcal{K}_{i+1}$, $A$ is
  also $\mathcal{K}_i$-closed.  By induction hypothesis, $A$ is also
  $\mathcal{L}_i$-closed, and since $\mathcal{L}_{i+1} \subseteq \mathcal{L}_i$, we obtain
  that $A$ is $\mathcal{L}_{i+1}$-closed.

  If $P_{i+1} = P_{i+2}$, nothing remains to be shown.  Therefore assume that $P_{i+1}
  \neq P_{i+2}$ and let $P_{i+1} \preceq A \prec P_{i+2}$.  By construction, all sets
  strictly between $P_{i+1}$ and $P_{i+2}$ are $\mathcal{L}_{i+1}$-closed if
  $\mathcal{K}_{i+2}$-closed, by definition of $P_{i+2}$.

  Therefore, only the case $A = P_{i+1} \neq P_{i+2}$ remains to be considered.  But then
  since $A$ is $\mathcal{K}_{i+2}$-closed and $P_{i+1} \neq P_{i+2}$ we know that
  $P_{i+1}$ is not $\mathcal{L}_{i+1}$-closed, as otherwise $P_{i+1} = P_{i+2}$.
  Therefore, $A = P_{i+1}$ is $\mathcal{L}_{i+1}$-closed as required.
\end{Proof}

\begin{Corollary}
  \label{cor:explore-implications-closures-coincide}
  Let $M$, $\leq_M$, $p$, $\mathcal{L}$, $\mathcal{K}$ as before, and denote with $n$ the
  number of iterations of the algorithm \lstinline{explore-implications} when applied to
  this input.  Then
  \begin{equation*}
    \Cn(\mathcal{K}_n) \supseteq \Cn(\mathcal{L}_n \cup \mathcal{K}).
  \end{equation*}
\end{Corollary}
\begin{Proof}
  By the previous \Cref{prop:explore-implications-closedness-persists} we know that all
  $\mathcal{K}_n$-closed subsets of $M$ are also $\mathcal{L}_n$-closed.  Let $(X \to Y)
  \in \Cn(\mathcal{L}_n)$.  Then $Y \subseteq \mathcal{L}_n(X) \subseteq
  \mathcal{L}_n(\mathcal{K}_n(X))$.  Clearly, $\mathcal{K}_n(X)$ is
  $\mathcal{K}_n$-closed, so \Cref{prop:explore-implications-closedness-persists} yields
  that $\mathcal{K}_n(X)$ is also $\mathcal{L}_n$-closed, \ie
  \begin{equation*}
    \mathcal{L}_n(\mathcal{K}_n(X)) = \mathcal{K}_n(X).
  \end{equation*}
  Thus, $Y \subseteq \mathcal{K}_n(X)$ and therefore $(X \to Y) \in \Cn(\mathcal{K}_n)$.
  Clearly, $\mathcal{K} \subseteq \Cn(\mathcal{K}_n)$, and thus $\Cn(\mathcal{K}_n)
  \supseteq \Cn(\mathcal{L}_n \cup \mathcal{K})$ as required.
\end{Proof}

\begin{Corollary}
  \label{cor:explore-implications-L_n-exactly-those-confirmed-by-expert}
  Let $M$, $\leq_M$, $p$, $\mathcal{L}$, $\mathcal{K}$ as before, and let again $n$ be
  the number of iterations of the run of \lstinline{explore-implications} when applied to
  this input.  Then
  \begin{equation*}
    \mathcal{L}_n = \Th(p) \cap \mathcal{L}.
  \end{equation*}
\end{Corollary}
\begin{Proof}
  We know that $\Th(p) \cap \mathcal{L} \subseteq \mathcal{L}_{n}$, since $p$ does not
  provide counterexamples for confirmed implications.  Since $\Cn(\mathcal{L}_{n} \cup
  \mathcal{K}) \subseteq \Cn(\mathcal{K}_{n})$ by
  \Cref{cor:explore-implications-closures-coincide}, we obtain $\mathcal{L}_{n} \subseteq
  \Cn(\mathcal{K}_{n})$.  Since all implications in $\mathcal{K}_{n}$ are confirmed by
  $p$, it is true that $\Cn(\mathcal{K}_{n}) \subseteq \Th(p)$.  Together with
  $\mathcal{L}_{n} \subseteq \mathcal{L}$ we thus obtain $\mathcal{L}_{n} \subseteq \Th(p)
  \cap \mathcal{L}$.
\end{Proof}

\begin{Theorem}
  \label{thm:explore-implications-correctness}
  Let $M$ be a finite set, $\leq_{M}$ be a linear order on $M$, and $p$ a domain expert on
  $M$. Let $\mathcal{L} \subseteq \Imp(M)$ and $\mathcal{K} \subseteq \Th(p) \cap
  \Cn(\mathcal{L})$.  If $n$ is the last iteration of \lstinline{explore-implications}
  applied to this input, then
  \begin{equation*}
    \Th(p) \cap \Cn(\mathcal{L}) \supseteq \Cn(\mathcal{K}_{n}) \supseteq \Cn(\Th(p) \cap \mathcal{L}).
  \end{equation*}
\end{Theorem}
\begin{Proof}
  Since $\mathcal{K} \subseteq \Cn(\mathcal{L})$, it is true that $\mathcal{K} \subseteq
  \Cn(\mathcal{L}_{n})$ and \Cref{cor:explore-implications-closures-coincide} yields
  $\Cn(\mathcal{K}_{n}) \supseteq \Cn(\mathcal{L}_{n})$.  Thus
  \begin{equation*}
    \Cn(\mathcal{K}_{n}) \supseteq \Cn(\mathcal{L}_{n}) = \Cn(\Th(p) \cap \mathcal{L})
  \end{equation*}
  by \Cref{cor:explore-implications-L_n-exactly-those-confirmed-by-expert}.

  Furthermore, $\Cn(\mathcal{L}) \supseteq \Cn(\mathcal{K}_{n})$ holds by the definition
  of $\mathcal{K}_{n}$.  Since all implications in $\mathcal{K}$ have been confirmed by
  the expert, $\Th(p) \supseteq \Cn(\mathcal{K}_{n})$ also holds.  This yields
  \begin{equation*}
    \Cn(\mathcal{L}) \cap \Th(p) \supseteq \Cn(\mathcal{K}_{n}),
  \end{equation*}
  as required.
\end{Proof}

The counterexamples given by the expert $p$ during the run of the algorithm can be
collected into a formal context $\con L$.  Then this formal context $\con L$ has the nice
property that every implication in $\mathcal{L}$ is either entailed by $\mathcal{K}_{n}$,
or does not hold in $\con L$.  This fact can be useful on its own.

\begin{Theorem}
  \label{thm:explore-implications-counterexamples-context}
  Let $M$ be a finite set, $\leq_{M}$ a linear order on $M$, and let $p$ be a domain
  expert on $M$. Let $\mathcal{L} \subseteq \Imp(M)$ and $\mathcal{K} \subseteq \Th(p)
  \cap \Cn(\mathcal{L})$.  Let $n$ be the last iteration of
  \lstinline{explore-implications} applied to this input, and let $\set{ C_{1}, \dots,
    C_{m} }$ be the counterexamples given by $p$ during this run.  Denote with $\con L$
  the formal context which arises from these counterexamples, \ie
  \begin{equation*}
    \con L = (\set{ C_{1}, \dots, C_{m} }, M, \ni).
  \end{equation*}
  Then for each implication $(A \to B) \in \mathcal{L}$ either $(A \to B) \in
  \Cn(\mathcal{K}_{n})$ or $(A \to B) \notin \Th(\con L)$, \ie
  \begin{equation*}
    \Cn(\mathcal{K}_{n}) \cap \mathcal{L} = \Th(\con L) \cap \mathcal{L}.
  \end{equation*}
\end{Theorem}
\begin{Proof}
  We first observe that
  \begin{equation}
    \label{eq:40}
    \mathcal{L}_{n} = \Th(\con L) \cap \mathcal{L}.
  \end{equation}
  Then from \Cref{cor:explore-implications-closures-coincide} we obtain
  \begin{equation}
    \label{eq:37}
    \Cn(\mathcal{K}_{n}) \supseteq \Cn(\mathcal{L}_{n}) = \Cn(\Th(\con L) \cap \mathcal{L}).
  \end{equation}
  Suppose that $(A \to B) \not\in \Cn(\mathcal{K}_{n})$.  Then $(A \to B) \not\in
  \Cn(\Th(\con L) \cap \mathcal{L})$ by \Cref{eq:37}.  Since $(A \to B) \in \mathcal{L}$,
  we obtain $(A \to B) \not\in \Th(\con L)$ as required.

  On the other hand, since $p$ does not provide counterexamples for confirmed
  implications, and all implications in $\mathcal{K}_{n}$ have been confirmed by $p$, we
  can infer that $\Cn(\mathcal{K}_{n}) \subseteq \Th(\con L)$.
\end{Proof}

An interesting observation for \Cref{alg:explore-implications} is the following: although
it may not hold that $\mathcal{K}_{n}$ is a base of $\mathcal{L} \cap \Th(p)$ with
background knowledge $\mathcal{K}$, the set of implications computed by
\lstinline{explore-implications} is \emph{minimal} in the sense that it is the canonical
base of itself, \ie
\begin{equation*}
  \Can(\mathcal{K}_{n}, \mathcal{K}) = \mathcal{K}_{n} \setminus \mathcal{K}.
\end{equation*}
This fact is indeed not very surprising, given that we have obtained
\Cref{alg:explore-implications} from
\Cref{alg:explore-attributes-with-next-closed-none-closed} by simple syntactic
substitutions.

Note that we had introduced the canonical base in \Cref{sec:bases-implications} only for
formal contexts, but it is not very difficult to generalize the definition (and the
corresponding results) to the level of sets of implications.  Indeed, if $\mathcal{L},
\mathcal{K} \subseteq \Imp(M)$, then the canonical base of $\mathcal{L}$ with background
knowledge $\mathcal{K}$ can just be defined to be the canonical base of $\con
K_{\mathcal{L}}$ with background knowledge $\mathcal{K}$, where $\con K_{\mathcal{L}}$ is
defined as in \Cref{prop:context-model-for-implications}.  However, we can also be a bit
more specific and generalize the notion of pseudo-intents correspondingly, by considering
the closure operator induced by $\mathcal{L}$ to be a generalization of the double-prime
operator $(\cdot)''$ of a formal context.

\begin{Definition}[$\mathcal{K}$-Pseudo-Closed Set of $\mathcal{L}$, Canonical Base]
  \label{def:pseudo-intents-for-implications}
  Let $M$ be a finite set and let $\mathcal{L}, \mathcal{K} \subseteq \Imp(M)$.  Then a
  set $P \subseteq M$ is called a \emph{$\mathcal{K}$-pseudo-closed set} of $\mathcal{L}$
  if and only if
  \begin{enumerate}[i. ]
  \item $P \neq \mathcal{L}(P)$,
  \item $P = \mathcal{K}(P)$, and
  \item for all $Q \subsetneq P$ being a $\mathcal{K}$-pseudo-closed set of $\mathcal{L}$
    it is true that $\mathcal{L}(Q) \subseteq P$.
  \end{enumerate}
  The \emph{canonical base} of $\mathcal{L}$ with background knowledge $\mathcal{K}$ is
  then defined as
  \begin{equation*}
    \Can(\mathcal{L}, \mathcal{K}) := \set{ P \to \mathcal{L}(P) \mid P \subseteq M \text{
        a } \mathcal{K} \text{ pseudo-closed set of } \mathcal{L} }.
  \end{equation*}
\end{Definition}

The relevant property of the canonical base now carries over to this generalized
formulation, just because
\begin{equation*}
  \Can(\mathcal{L}, \mathcal{K}) = \Can(\con K_{\mathcal{L}}, \mathcal{K}).
\end{equation*}
Thus, the following corollary follows directly from
\Cref{thm:canonical-base-with-arbitrary-background-knowledge}.

\begin{Corollary}
  \label{cor:canonical-base-for-implications}
  Let $M$ be a finite set and let $\mathcal{L}, \mathcal{K} \subseteq \Imp(M)$.  Then
  $\Can(\mathcal{L}, \mathcal{K})$ is a set of valid implications of $\mathcal{L}$ such
  that
  \begin{equation*}
    \Can(\mathcal{L}, \mathcal{K}) \cup \mathcal{K}
  \end{equation*}
  is complete for $\mathcal{L}$, and $\Can(\mathcal{L}, \mathcal{K})$ has minimal
  cardinality with this property.  In particular, if $\mathcal{K} \subseteq
  \Cn(\mathcal{L})$, then $\Can(\mathcal{L}, \mathcal{K})$ is a minimal base of
  $\mathcal{L}$ with background knowledge $\mathcal{K}$.
\end{Corollary}

We now show that \Cref{alg:explore-implications} computes the canonical base of $\Th(p)
\cap \mathcal{L}$ with background knowledge $\mathcal{K}$.

\begin{Theorem}
  \label{thm:explore-implications-computes-canonical-base}
  Let $M$ be a finite set, $\leq_{M}$ be a linear order on $M$, $p$ a domain expert on
  $M$, $\mathcal{L} \subseteq \Imp(M)$ and $\mathcal{K} \subseteq \Th(p) \cap
  \mathcal{L}$.  If
  \begin{equation*}
    \mathcal{K}_{n} = \text{\lstinline{explore-implications}}(M, \leq_{M}, p, \mathcal{L}, \mathcal{K}),
  \end{equation*}
  then
  \begin{equation*}
    \Can(\mathcal{K}_{n}, \mathcal{K}) = \mathcal{K}_{n} \setminus \mathcal{K}.
  \end{equation*}
\end{Theorem}
\begin{Proof}
  First note that $\mathcal{K}_{n} \setminus \mathcal{K}$ is an irredundant base of
  $\mathcal{K}_{n}$ with background knowledge $\mathcal{K}$, \ie no implication in
  $\mathcal{K}_{n}$ follows from the others and $\mathcal{K}$.

  We are going to show that the premises in $\mathcal{K}_{n} \setminus \mathcal{K}$ are
  all $\mathcal{K}$-pseudo-closed sets of $\mathcal{K}_{n}$.  For this, we show the
  following claim by induction over the number $i$ of iterations:
  \begin{quote}
    For every iteration $i$, the $k := \abs{ \mathcal{K}_{n} \setminus \mathcal{K} }$
    lectically first $\mathcal{K}$-pseudo-closed sets of $\mathcal{K}_{n}$ are precisely
    the premises of the implications in $\mathcal{K}_{n} \setminus \mathcal{K}$.  If the
    $(k+1)$st $\mathcal{K}$-pseudo-closed set $Q$ of $\mathcal{K}_{n}$ exists, then
    $P_{i+1} \subseteq M$ (\ie is not \lstinline{nil}), and $P_{i+1} \preceq Q$.
  \end{quote}

  For the base case $i = 0$ we observe that $\abs{ \mathcal{K}_{0} \setminus \mathcal{K} }
  = 0$, thus the first part of the claim holds.  If $Q$ is the first
  $\mathcal{K}$-pseudo-closed set of $\mathcal{K}_{n}$, then $Q$ is $\mathcal{K}$-closed
  but not $\mathcal{K}_{n}$-closed.  But then $Q$ is also not $\mathcal{L}$-closed,
  because $\mathcal{K}_{n} \subseteq \Cn(\mathcal{L})$.  Therefore, by construction,
  $P_{1}$ is not \lstinline{nil} and $P_{1} \preceq Q$.

  For the induction step we assume that the claim holds for iteration $i$.  Let $k :=
  \abs{ \mathcal{K}_{i} \setminus \mathcal{K} }$.  If there is no more
  $\mathcal{K}$-pseudo-closed set of $\mathcal{K}_{n}$ which is not already a premise of
  an implication in $\mathcal{K}_{i} \setminus \mathcal{K}$, then $\mathcal{K}_{i}$ is a
  base of $\mathcal{K}_{n}$ with background knowledge $\mathcal{K}$.  Since
  $\mathcal{K}_{i} \subseteq \mathcal{K}_{n}$ we obtain $\mathcal{K}_{i} =
  \mathcal{K}_{n}$, since $\mathcal{K}_{n}$ is irredundant.  Then $i = n$, or $i < n$ and
  $\abs{ \mathcal{K}_{i+1} \setminus \mathcal{K}_{n} } = k$ and the claim holds for
  iteration $i+1$ as well.

  Now assume that $Q$ is the $(k+1)$st $\mathcal{K}$-pseudo-closed set of
  $\mathcal{K}_{n}$.  By induction hypothesis, $P_{i+1} \subseteq M$ and $P_{i+1} \preceq
  Q$.  We consider two main cases.

  \textit{Case $P_{i+1} = Q$}:  If $\mathcal{L}_{i}(P_{i+1}) \subseteq
  \mathcal{K}_{n}(P_{i+1})$, then $p$ accepts the implication
  \begin{equation*}
    P_{i+1} \to \mathcal{L}_{i}(P_{i+1}),
  \end{equation*}
  which is then an element of $\mathcal{K}_{i+1}$.  Thus, the $\abs{ \mathcal{K}_{i+1}
    \setminus \mathcal{K} } = k + 1$ lectically first $\mathcal{K}$-pseudo-closed sets of
  $\mathcal{K}_{n}$ are precisely the premises of the implications in $\mathcal{K}_{i+1}
  \setminus \mathcal{K}$.

  If the $(k+2)$nd $\mathcal{K}$-pseudo-closed set $\overline Q$ of $\mathcal{K}_{n}$
  exists, then in particular $\overline Q$ is closed under $\mathcal{K}_{i+1}$, as for
  each $\mathcal{K}$-pseudo-closed set $P_{\ell} \subseteq \overline Q$ it is true tat
  $\mathcal{K}_{n}(P_{\ell}) \subseteq \overline Q$.  Furthermore, $\overline Q$ is not
  $\mathcal{K}_{n}$-closed, and thus also not $\mathcal{L}_{i+1}$-closed.  Therefore, by
  construction $P_{i+2} \subseteq M$, \ie is not \lstinline{nil}, and $P_{i+2} \preceq Q$.

  If $\mathcal{L}_{i}(P_{i+1}) \not\subseteq \mathcal{K}_{n}(P_{i+1})$, then $p$ rejects
  the implication $P_{i+1} \to \mathcal{L}_{i}(P_{i+1})$ and provides a counterexample.
  Then $\mathcal{K}_{i+1} = \mathcal{K}_{i}$.  Since $P_{i+1} = Q$, the set $P_{i+1}$ is
  also not $\mathcal{L}_{i+1}$-closed, as otherwise it would be $\mathcal{K}_{n}$-closed.
  Thus, $P_{i+2} = P_{i+1}$ and $P_{i+2} \preceq Q$ as required.

  \textit{Case $P_{bi+1} \precneq Q$}: In this case, the set $P_{i+1}$ must be
  $\mathcal{K}_{n}$-closed, since otherwise it would be a $\mathcal{K}$-pseudo-closed set
  of $\mathcal{K}_{n}$, and $P_{i+1} \succeq Q$ would hold.  To see this, we first observe
  that $P_{i+1}$ is $K_{i}$-closed by definition, and thus also $\mathcal{K}$-closed.
  Furthermore, if $\overline Q \subsetneq P_{i+1}$ is a $\mathcal{K}$-pseudo-closed set of
  $\mathcal{K}_{n}$, then by induction hypothesis, the set $\overline Q$ is a premise of
  $\mathcal{K}_{i}$ and therefore $\mathcal{K}_{n}(\overline Q) \subseteq P_{i+1}$.  Thus,
  the only possibility for $P_{i+1}$ not to be a $\mathcal{K}$-pseudo-closed set of
  $\mathcal{K}_{n}$ is that $P_{i+1}$ is $\mathcal{K}_{n}$-closed.

  In addition, $P_{i+1}$ is not $\mathcal{L}_{i}$-closed by definition.  Thus, since
  $P_{i+1}$ is $\mathcal{K}_{n}$-closed, the expert rejects the implication $P_{i+1} \to
  \mathcal{L}_{i}(P_{i+1})$.  Therefore, $\mathcal{K}_{i+1} = \mathcal{K}_{i}$ and
  $P_{i+2}$ is the lectically smallest $\mathcal{K}_{i+1}$-closed, not
  $\mathcal{L}_{i+1}$-closed set which is lectically greater or equal to $P_{i+1}$.  Since
  $Q$ is also $\mathcal{K}_{i+1}$-closed (by induction hypothesis, as it is a
  $\mathcal{K}$-pseudo-closed set of $\mathcal{K}_{n}$) but not $\mathcal{L}_{i+1}$-closed
  (since $Q$ is not $\mathcal{K}_{n}$-closed), it is true that $P_{i+2} \preceq Q$ by
  construction.

  This finishes the step case and the proof of the above claim.  Using this claim, we
  shall now show the theorem.  Note that for each implication $(P_{i} \to
  \mathcal{L}_{i-1}(P_{i})) \in \mathcal{K}_{n} \setminus \mathcal{K}$ it is true that
  \begin{equation}
    \label{eq:38}
    \mathcal{L}_{i-1}(P_{i}) = \mathcal{K}_{n}(P_{i})
  \end{equation}
  because $\mathcal{L}_{i}(P_{i})$ is already $\mathcal{K}_{n}$-closed, and $(P_{i} \to
  \mathcal{L}_{i-1}(P_{i})) \in \mathcal{K}_{n} \setminus \mathcal{K}$.  If now $n$
  denotes the last iteration of the algorithm, we known that $P_{n+1}$ is equal to
  \lstinline{nil}.  Therefore, there cannot exist a $\mathcal{K}$-pseudo-closed set of
  $\mathcal{K}_{n}$ which is not a premise of an implication in $\mathcal{K}_{n} \setminus
  \mathcal{K}$.  Because of \Cref{eq:38}, we therefore obtain
  \begin{equation*}
    \mathcal{K}_{n} \setminus \mathcal{K} = \Can(\mathcal{K}_{n}, \mathcal{K})
  \end{equation*}
  as required.
\end{Proof}

Recall that our initial motivation to consider the generalization of attribute exploration
as given in \Cref{alg:explore-implications} was to be able to explore sets of the form
$\Th_{c}(\con K)$ for arbitrary choices of $c \in [0,1]$.  However, for this particular
application our algorithm does not seem very practical, as during a run we would need to
compute sets of the form $\mathcal{L}_{i}(P)$ for some $\mathcal{L}_{i} \subseteq
\Th_{c}(\con K)$ and $P \subseteq M$.  For $c = 1$ this is not a problem, since
\begin{equation*}
  \Th_{1}(\con K)(P) = \Th(\con K)(P) = P''.
\end{equation*}
For $c \neq 1$, however, such a simple computation is not known.  Although we shall
discuss in \Cref{sec:expl-conf-1} some techniques to still achieve the computation of
$\Th_{c}(\con K)(P)$, the computation itself is potentially much more expensive than in
the case $c = 1$.

Also, the fact that \Cref{alg:explore-implications} only provides an approximate
exploration of $\mathcal{L}$ using $p$ as an expert is unsatisfactory.  Of course, this
situation can easily be avoided if the implications asked to the expert are elements of
$\mathcal{L}$, because then $\Cn(\mathcal{K}_{n}) \subseteq \mathcal{L} \cap \Th(p)$ and
thus~\Cref{thm:explore-implications-correctness} yields that
\begin{equation*}
  \Cn(\mathcal{K}_{n}) = \Cn(\mathcal{L} \cap \Th(p)),
\end{equation*}
\ie $\mathcal{K}_{n}$ is a base of $\mathcal{L} \cap \Th(p)$.

However, it cannot be guaranteed in general that the implications $P_{i+1} \to
\mathcal{L}_{i}(P_{i+1})$ are elements of $\mathcal{L}$.  To remedy this problem, we shall
discuss in the following a relaxation of \Cref{alg:explore-implications} that allows for
more freedom in the choice which implications are asked to the expert.  In this way, it
may be easier to ensure that the implications asked are indeed elements of $\mathcal{L}$,
and thus the exploration does not contain too many questions.  We shall see in
\Cref{sec:poss-fast-expl} how this idea can be applied for our case of exploration by
confidence.

In this relaxation, instead of asking questions of the form $P_{i+1} \to
\mathcal{L}_{i}(P_{i+1})$, it will be sufficient to find \emph{some} $Q \subseteq M$ such
that $P_{i+1} \subsetneq Q \subseteq \mathcal{L}_{i}(P_{i+1})$, and then ask the
implication $P \to Q$ to the expert.  Of course, we have to pay for the freedom of
choosing the set $Q$ freely by potentially asking more questions, since the implication
\begin{equation*}
  P_{i+1} \to \mathcal{L}_{i}(P_{i+1}) \setminus Q
\end{equation*}
still needs to be examined (implicitly or explicitly) by the expert.  The hope is that the
freedom of leaving out elements from $\mathcal{L}_{i}(P_{i+1})$ compensates for this extra
amount of implications the expert has to handle.

\addfunctionname{explore-implications/weaker-version}

\begin{figure}[tp]
  \begin{Algorithm}[Generalized Exploration of Sets of Implications]
    \label{alg:explore-implications-weaker-version}
    \hspace*{0cm}
\begin{lstlisting}
define explore-implications/weaker-version($M$, $\leq_{M}$, $p$, $\mathcal{L} \subseteq \Imp(M)$, $\mathcal{K} \subseteq \Th(p)$)
  $i$ := 0, $\mathcal{L}_i$ := $\mathcal{L}$, $\mathcal{K}_i$ := $\mathcal{K}$, $P_i$ := $\emptyset$

  forever do
    $P$ := next-closed-non-closed($M$, $\leq_M$, $P_i$, $\mathcal{K}_i$, $\mathcal{L}_i$)$\label{lst:explore-implications-weaker-version-1}$
    if $P =$ nil exit
    choose $P_{i+1} \subseteq M \text{ such that } P_{i} \preceq P_{i+1} \preceq P \text{ and }
P_{i+1} \text{ not } \mathcal{L}_{i}\text{-closed}$
    choose $Q \subseteq M \text{ such that } P_{i+1} \subsetneq Q \subseteq \mathcal{L}_{i}(P_{i+1})$, $Q \not\subseteq \mathcal{K}_{i}(P_{i+1})$

    if $p(P_{i+1} \to Q) = \top$ then
      $\mathcal{K}_{i+1}$ := $\mathcal{K}_i \cup \set{ P_{i+1} \to Q }$
      $\mathcal{L}_{i+1}$ := $\mathcal{L}_i$
    else
      $\mathcal{K}_{i+1}$ := $\mathcal{K}_i$
      $C$ := $p(P_{i+1} \to Q)$
      $\mathcal{L}_{i+1}$ := $\set{ (A \to B) \in \mathcal{L}_i \mid A \not\subseteq C
\text{ or } B \subseteq C }$
    end

    $i$ := $i + 1$
  end

  return $\mathcal{K}_i$
end
\end{lstlisting}
  \end{Algorithm}
\end{figure}

\Cref{alg:explore-implications-weaker-version} presents a generalization of
\Cref{alg:explore-implications} that uses these ideas.
\Cref{alg:explore-implications-weaker-version} is very similar to
\Cref{alg:explore-implications}, but differs in a crucial aspect: we still compute sets of
the form
\begin{equation*}
  P = \text{\lstinline{next-closed-non-closed}}(M, \leq_{M}, P_{i}, \mathcal{K}_{i}, \mathcal{L}_{i}),
\end{equation*}
but we then do not directly ask $P \to \mathcal{L}_{i}(P)$ to the expert.  Instead, we
allow the algorithm to choose a set $P_{i+1}$ such that
\begin{equation*}
  P_{i} \preceq P_{i+1} \preceq P
\end{equation*}
and $P_{i+1}$ is not $\mathcal{L}_{i}$-closed.  Note that such a set always exists since
$P$ is not $\mathcal{L}_{i}$-closed.

Since $P_{i+1}$ is not $\mathcal{L}_{i}$-closed, $P_{i+1} \subsetneq
\mathcal{L}_{i}(P_{i+1})$.  We then choose a set $Q$ such that
\begin{equation*}
  P_{i+1} \subsetneq Q \subseteq \mathcal{L}_{i}(P_{i+1})
\end{equation*}
and finally ask the implication $P \to Q$ to the expert.

Note that if we always choose $P_{i+1} = P$ and $Q = \mathcal{L}_{i}(P_{i+1})$, then we
obtain \Cref{alg:explore-implications} again.

We now argue that \Cref{alg:explore-implications-weaker-version} is indeed an algorithm
that allows to approximately explore $\mathcal{L}$, using $p$ as an expert and
$\mathcal{K}$ as background knowledge.  For this we first observe that termination can be
argued as in the case of \Cref{alg:explore-implications}, and therefore the analog of
\Cref{thm:explore-implications-termination} holds.

\begin{Theorem}
  \label{thm:explore-implications-weaker-version-termination}
  Let $M$ be a finite set, $\leq_{M}$ a linear order on $M$, $p$ be a domain expert on
  $M$, $\mathcal{L} \subseteq \Imp(M)$ and $\mathcal{K} \subseteq \Th(p)$.  Then the call
  to \Cref{alg:explore-implications-weaker-version} with this input terminates after
  finitely many steps.
\end{Theorem}

For the correctness of \Cref{alg:explore-implications-weaker-version} we can argue in
practically the same way as we did for \Cref{alg:explore-implications}.  The crucial
argument there was \Cref{prop:explore-implications-closedness-persists}, which also holds
in this case, with nearly the same proof.  We shall repeat it nevertheless for easier
comparison.

\begin{Proposition}
  \label{prop:explore-implications-weaker-version-closedness-persists}
  Let $M$, $\leq_{M}$, $p$, $\mathcal{L}$, $\mathcal{K}$ as before.  Then for every
  iteration $i$ in the run of
  \begin{equation*}
    \text{\lstinline{explore-implications/weaker-version}}(M, \leq_{M}, p, \mathcal{L}, \mathcal{K})
  \end{equation*}
  if $P_{i+1}$ is not \lstinline{nil}, it is true for all $A \prec P_{i+1}$ that, if $A$
  is $\mathcal{K}_{i}$-closed, then $A$ is also $\mathcal{L}_{i}$-closed.
\end{Proposition}
\begin{Proof}
  Again we show the claim by induction over $i$.  For the base case $i = 0$ we know that
  $P_{i} = \emptyset$, and thus the claim is vacuously true.

  For the step case assume the validity of the proposition for iteration $i$.  Then if
  $P_{i+2}$ is not \lstinline{nil} we need to show that for each $A \preceq P_{i+2}$, if
  $A$ is $\mathcal{K}_{i+1}$-closed, then $A$ is also $\mathcal{L}_{i+1}$-closed.

  As before we can reduce this to the case that $P_{i+1} \preceq A \precneq P_{i+2}$ and
  $A$ being $\mathcal{K}_{i+1}$-closed.  In particular $P_{i+1} \neq P_{i+2}$.  Then
  $P_{i+1} = A$ is the only interesting case, since all sets strictly lectically lying
  between $P_{i+1}$ and $P_{i+2}$ which are $\mathcal{K}_{i+1}$-closed are also
  $\mathcal{L}_{i+1}$-closed, due to the construction of $P_{i+2}$.  Since $P_{i+1} \neq
  P_{i+2}$ we know that $P_{i+1}$ must also be $\mathcal{L}_{i+1}$-closed, as otherwise
  the algorithm would compute $P_{i+1} = P_{i+2}$.  Thus, $A = P_{i+1}$ is also
  $\mathcal{L}_{i+1}$-closed, as required.
\end{Proof}

Now most of the properties of \Cref{alg:explore-implications} carry over to
\Cref{alg:explore-implications-weaker-version}.  However, since we do not necessarily ask
implications of the form
\begin{equation}
  \label{eq:39}
  P_{i+1} \to \mathcal{L}_{i}(P_{i+1})
\end{equation}
anymore, we can also not expect that the algorithm computes the canonical base of
$\mathcal{K}_{n}$ with background knowledge $\mathcal{K}$.  In particular this means that
the number of implications asked to and confirmed by the expert is not necessarily
minimal.

\begin{Theorem}
  \label{thm:explore-implications-weaker-version-all-other-properties}
  Let $M$ be a finite set, $\leq_{M}$ be a linear order on $M$, and let $p$ be a domain
  expert on $M$.  Let $\mathcal{L} \subseteq \Imp(M)$ and $\mathcal{K} \subseteq \Th(p)
  \cap \Cn(\mathcal{L})$.  Denote with $n$ the last iteration of the run of
  \Cref{alg:explore-implications-weaker-version} applied to this input.  Then
  \begin{enumerate}[i. ]
  \item $\Cn(\mathcal{K}_{n}) \supseteq \Cn(\mathcal{L}_{n})$,
  \item $\mathcal{L}_{n} = \Th(p) \cap \mathcal{L}$, and
  \item $\Th(p) \cap \Cn(\mathcal{L}) \supseteq \Cn(\mathcal{K}_{n}) \supseteq \Cn(\Th(p) \cap \mathcal{L})$.
  \end{enumerate}
\end{Theorem}

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

As a first step to achieve an algorithm for exploration by confidence we shall instantiate
\Cref{alg:explore-implications} for $\mathcal{L} = \Th_{c}(\con K)$.  This will be done in
\Cref{sec:expl-conf-1}.  While this approach is conceptually trivial, it entails some
technical problems, the most serious of them being able to compute closures of the form
\begin{equation*}
  \Th_{c}(\con K)(P)
\end{equation*}
for sets $P \subseteq M$.  We discuss some approaches how to achieve this computation more
efficiently than by iterating through $\Th_{c}(\con K)$, which are, however, still
potentially expensive.  Furthermore, in the general case this exploration will only be
approximative, which may or may not be a problem, depending on the current application.

To remedy these problems, we use our weaker formulation of
\Cref{alg:explore-implications-weaker-version} and derive from it in
\Cref{sec:poss-fast-expl} an algorithm for exploration by confidence that avoids computing
closures under $\Th_{c}(\con K)$.  In addition, for this algorithm we can ensure that all
implications asked to the expert satisfy the confidence constraint given by $c$.  The
price we have to pay for this is an increase in the number of questions asked to the
expert, and the fact that we do not compute the canonical base anymore.

\subsection{An Approximative Exploration by Confidence}
\label{sec:expl-conf-1}

We obtain our first algorithm for exploration by confidence by instantiating
\Cref{alg:explore-implications} with $\mathcal{L} = \Th_{c}(\con K)$.  The first problem
we have to face here is how to implement \Cref{lst:explore-implications-1} in the
algorithm, \ie
\begin{equation*}
  \mathcal{L}_{i+1} := \set{ (A \to B) \in \mathcal{L}_{i} \mid A \not\subseteq C \text{
      or } B \subseteq C }.
\end{equation*}
Naively, if $\mathcal{L} = \Th_{c}(\con K)$, this statement can be implemented by
enumerating all implications in $\Th_{c}(\con K)$, an approach which we want to avoid for
obvious reasons.  Instead, we collect all counterexamples in a formal context $\con L_{i}$
as we did in \Cref{thm:explore-implications-counterexamples-context}, and then use the
fact which we already used in the proof of this statement (\Cref{eq:40}), which in our
case amounts to
\begin{equation*}
  \mathcal{L}_{i} = \Th_{c}(\con K) \cap \Th(\con L_{i}).
\end{equation*}

\addfunctionname{exploration-by-confidence}

\begin{figure}[tp]
  \centering
  \begin{Algorithm}[Exploration by Confidence, Approximative Version]
    \label{alg:exploration-by-confidence-first-version}
    \hspace*{0cm}
\begin{lstlisting}
define exploration-by-confidence($\con K = (G, M, I)$, $\leq_M$, $p$, $c \in [0,1]$, $\mathcal{K} \subseteq \Th(p)$)
  $i$ := 0, $\con L_{i} = (\emptyset, M, \emptyset)$, $\mathcal{K}_i$ := $\mathcal{K}$, $P_i$ := $\emptyset$

  forever do
    $\mathcal{L}_{i}$ := $\Th_{c}(\con K) \cap \Th(\con L_{i})$
    $P_{i+1}$ := next-closed-non-closed($M$, $\leq_M$, $P_i$, $\mathcal{K}_i$, $\mathcal{L}_i$)
    if $P_{i+1} =$ nil exit

    if $p(P_{i+1} \to \mathcal{L}_i(P_{i+1})) = \top$ then
      $\mathcal{K}_{i+1}$ := $\mathcal{K}_i \cup \set{ P_{i+1} \to \mathcal{L}_i(P_{i+1}) }$
      $\con L_{i+1}$ := $\con L_{i}$
    else
      $\mathcal{K}_{i+1}$ := $\mathcal{K}_i$
      $\con L_{i+1}$ := $\con L_{i} + p(P_{i+1} \to \mathcal{L}_i(P_{i+1}))$ ;; add counterexample to $\con L_{i}$
    end

    $i$ := $i + 1$
  end

  return $\mathcal{K}_i$
end
\end{lstlisting}
  \end{Algorithm}
\end{figure}

The algorithm we thus obtain is shown in
\Cref{alg:exploration-by-confidence-first-version}.  The following result is an immediate
consequence of the results we have obtained for \Cref{alg:explore-implications}.

\begin{Corollary}
  \label{cor:exploration-by-confidence-first-version}
  Let $\con K = (G, M, I)$ be a finite formal context, $\leq_{M}$ a linear order on $M$,
  $c \in [0,1]$, $p$ a domain expert on $M$ and $\mathcal{K} \subseteq \Th_{c}(\con K)
  \cap \Th(p)$.  Then the call of \Cref{alg:exploration-by-confidence-first-version} with
  this input terminates after finitely many steps.  If $n$ is the number of iterations of
  this call, and if $\mathcal{K}_{n}$ is the corresponding return value, then
  \begin{equation*}
    \Th(p) \cap \Cn(\Th_{c}(\con K)) \supseteq \Cn(\mathcal{K}_{n}) \supseteq \Cn(\Th(p)
    \cap \Th_{c}(\con K)).
  \end{equation*}
  Moreover, $\mathcal{K}_{n} \setminus \mathcal{K}$ is the canonical base of itself.
\end{Corollary}

Recall that when we motivated exploration by confidence we mentioned the need to
distinguish between different forms of counterexamples: if $(A \to B) \in \Imp(M)$, then
the counterexamples for $A \to B$ contained in $\con K$ can possibly be ignored if only
$\conf_{\con K}(A \to B) \ge c$.  On the other hand, if our expert $p$ provides a
counterexample for $A \to B$, then this counterexample cannot be ignored, even if the
confidence of $A \to B$ would still be sufficiently high.

Our \Cref{alg:exploration-by-confidence-first-version} solves this problem by just
considering two formal contexts, namely $\con K$ on the one hand, where we apply the
confidence threshold, and $\con L_{i}$ on the other hand, of which we only consider valid
implications.  This distinction is immediate if we consider the definition of
$\mathcal{L}_{i}$, namely
\begin{equation*}
  \mathcal{L}_{i} = \Th_{c}(\con K) \cap \Th(\con L_{i}).
\end{equation*}

Of course this solution is only practical if we can efficiently compute closures under
$\mathcal{L}_{i}$.  As already mentioned, we want to avoid enumerating $\Th_{c}(\con K)$
at all costs, as otherwise the algorithm becomes impractical even from a theoretical point
of view.

It is worth noting that an apparently simpler approach to avoid computing closures under
$\Th_{c}(\con K)$ does not work.  More precisely, one may be tempted to replace in
\Cref{alg:exploration-by-confidence-first-version} all implications of the form
\begin{equation}
  \label{eq:62}
  P_{i+1} \to \mathcal{L}_{i}(P_{i+1})
\end{equation}
simply by
\begin{equation}
  \label{eq:63}
  P_{i+1} \to \set{ m \in (P_{i+1})_{\con L_{i}}'' \mid \conf_{\con K}(P_{i+1} \to
    \set{ m }) \ge c }.
\end{equation}
However, the resulting algorithm would not be complete, \ie implications with high
confidence in $\con K$ may not be asked to the expert.  This is illustrated by the
following example.

\begin{Example}
  \label{expl:simple-exploration-by-confidence-does-not-work}
  \begin{figure}[t]
    \centering
    \def\x{\times}
    \begin{math}
      \begin{array}{c|ccc}
        \toprule
        \con K & \mathsf{a} & \mathsf{b} & \mathsf{c} \\
        \midrule
        1 & \x & \x &    \\
        2 & \x & \x &    \\
        3 & \x & \x &    \\
        4 & \x & \x & \x \\
        5 & \x & \x & \x \\
        6 & \x &    & \x \\
        7 & \x &    & \x \\
        8 &    &    &    \\
        9 &    &    &    \\
        10 &   &    &    \\
        \bottomrule
      \end{array}
    \end{math}
    \caption{\label{fig:simple-exploration-by-confidence-does-not-work} Context which
      shows that a simple approach to exploration by confidence does not work}
  \end{figure}

  Consider the formal context $\con K$ as given in
  \Cref{fig:simple-exploration-by-confidence-does-not-work}, let $\mathcal{K} = \set{
    \set{\mathsf{a}} \to \set{\mathsf{b}} }$, and choose $c = \frac 1 2$.  Suppose that we
  apply exploration by confidence in the simplified version as described before, \ie we
  ask implications of the form of~(\ref{eq:63}) instead of those in~(\ref{eq:62}).  Then
  since all sets $P_{i+1}$ are closed under $\mathcal{K}$, the implication $\set{
    \mathsf{a} } \to \set{ \mathsf{c} }$ is never asked to the expert, because $\set{
    \mathsf{a} }$ is not closed under $\mathcal{K}$.  On the other hand,
  \begin{equation*}
    \conf_{\con K} ( \set{ \mathsf{a} } \to \set{ \mathsf{c} }) = \frac 4 7 > \frac 1 2,
  \end{equation*}
  \ie $(\set{ \mathsf{a} } \to \set{ \mathsf{c} }) \in \Th_{c}(\con K)$, and thus should
  actually be asked to the expert.  Furthermore, the implication $\set{ \mathsf{a} } \to
  \set{ \mathsf{c} }$ also does not follow form other implications asked to the expert, as
  the implications $\set{ \mathsf{b} } \to \set{ \mathsf{c} }$, $\set{ \mathsf{a},
    \mathsf{b} } \to \set{ \mathsf{c} }$, and $\emptyset \to \set{ \mathsf{c} }$ will also
  not be asked to the expert, because
  \begin{align*}
    \conf_{\con K} (\set{ \mathsf{b} } \to \set{ \mathsf{c} }) &= \frac 2 5 < \frac 1 2\\
    \conf_{\con K} (\set{ \mathsf{a}, \mathsf{b} } \to \set{ \mathsf{c} }) &= \frac 2 5 <
    \frac 1 2\\
    \conf_{\con K}( \emptyset \to \set{ \mathsf{c} } ) &= \frac 4 {10} < \frac 1 2
  \end{align*}
  Thus, if we assume that the expert $p$ confirms all proposed implications, and if we
  denote the set of confirmed implications by $\mathcal{K}_{n}$, then
  \begin{equation*}
    \mathcal{K}_{n}(\set{ \mathsf{a} }) = \set{ \mathsf{a}, \mathsf{b} }.
  \end{equation*}
  However, $\Th_{c}(\con K) \cap \Th(p) = \Th_{c}(\con K)$, and
  \begin{equation*}
    \Th_{c}(\con K)(\set{ \mathsf{a} }) = \set{ \mathsf{a}, \mathsf{b}, \mathsf{c} }.
  \end{equation*}
  Thus, the set $\mathcal{K}_{n}$ is not complete for $\Th_{c}(\con K) \cap \Th(p)$.
\end{Example}

On the other hand, it is possible to ask implications as in~(\ref{eq:63}) instead of those
in~(\ref{eq:62}) and still obtain a correct algorithm for exploration by confidence.
However, to ensure completeness, extra steps are necessary in the algorithm.  We shall see
in \Cref{sec:poss-fast-expl} how this can be done.

In the rest of this section we shall discuss an approach which allows to compute closures
under $\Th_{c}(\con K)$ at least a bit more efficiently.  In what follows we shall
consider derivation in various contexts, namely in $\con K$, $\con L_{i}$ and the
\emph{subposition} of $\con K = (G, M, I)$ and $\con L_{i} = (G_{i}, M, I_{i})$, which is
the formal context
\begin{equation*}
  \con K \div \con L_{i} := \frac {\con K} {\con L_{i}} := (G \cup G_{i}, M, I \cup I_{i}),
\end{equation*}
where we assume that $G$ and $G_{i}$ are disjoint.  To avoid confusion we shall denote the
derivation operators by $(\cdot)'_{\con K}$, $(\cdot)'_{\con L_{i}}$ and $(\cdot)'_{\con K
  \div \con L_{i}}$, respectively.  To ease readability, we shall also write
$(\cdot)''_{\con K}$ instead of $((\cdot)'_{\con K})'_{\con K}$, and likewise for the
other contexts.

To achieve the computation of $\mathcal{L}_{i}(P)$ for some $P$ we first recall the
definition of $\mathcal{L}_{i}(P)$ as given in \Cref{def:induced-closure-operator}.  There
we had defined
\begin{align*}
  \mathcal{L}^{1}(P) &:= P \cup \bigcup \set{ B \mid (A \to B) \in \mathcal{L}, A
    \subseteq P }, \\
  \mathcal{L}^{j+1}(P) &:= \mathcal{L}^{j}(\mathcal{L}^{1}(P)) \quad (j \in \NN_{> 0}), \\
  \mathcal{L}(P) & := \bigcup_{i \in \NN_{>0}} \mathcal{L}^{i}(P).
\end{align*}
Therefore, if we can find a way to compute $\mathcal{L}_{i}^{1}(P)$ for $\mathcal{L}_{i} =
\Th_{c}(\con K) \cap \Th(\con L_{i})$, then we are in principle able to compute
$\mathcal{L}_{i}(P)$.  Note that we only have to consider $\mathcal{L}_{i}^{j}(P)$ for up
to $j = \abs M$ at most, because $\abs{ \mathcal{L}_{i}(P) } \le \abs M$.

As a first observation, to compute $\mathcal{L}_{i}^{1}(P)$ for arbitrary $P \subseteq M$
we observe that
\begin{equation}
  \label{eq:41}
  P_{\con K \div \con L_{i}}'' \subseteq \mathcal{L}_{i}^{1}(P).
\end{equation}
The reason for that is that we have $P_{\con K \div \con L_{i}}'' \subseteq P_{\con K}''$
and thus the implication $P \to P_{\con K \div \con L_{i}}''$ is valid in $\con K$, and in
particular $(P \to P_{\con K \div \con L_{i}}'') \in \Th_{c}(\con K)$.  The same
argumentation shows that $P_{\con K \div \con L_{i}}'' \subseteq P_{\con L_{i}}''$, and
thus $(P \to P_{\con K \div \con L_{i}}'') \in \Th(\con L_{i})$.  Putting these facts
together we obtain
\begin{equation*}
  (P \to P_{\con K \div \con L_{i}}'') \in \Th_{c}(\con K) \cap \Th(\con L_{i}) = \mathcal{L}_{i}
\end{equation*}
and therefore $P_{\con K \div \con L_{i}}'' \subseteq \mathcal{L}_{i}^{1}(P)$.

To completely compute $\mathcal{L}_{i}^{1}(P)$ we need to consider all implications $(A
\to B) \in \mathcal{L}_{i}$ such that $A \subseteq P$.  If $A \to B$ is valid in $\con K$,
then we know that $B \subseteq P_{\con K \div \con L_{i}}''$.  Therefore, by \Cref{eq:41},
the difficult part in computing $\mathcal{L}_{i}^{1}(P)$ is to compute the set
\begin{equation*}
  \mathcal{L}_{i}^{1}(P) \setminus P_{\con K \div \con L_{i}}''.
\end{equation*}

One way to achieve this is to consider all implications $A \to B$ which are not valid in
$\con K$, but whose confidence is at least $c$ in $\con K$, \ie
\begin{equation*}
  1 > \conf_{\con K}(A \to B) \ge c.
\end{equation*}
Additionally, we can assume without loss of generality that $\abs B = 1$, because
\begin{equation*}
  \conf_{\con K}(A \to \set{ b }) \ge \conf_{\con K}(A \to B)
\end{equation*}
is true for all $b \in B$.  Finally, since $\mathcal{L}_{i} \subseteq \Th(\con L_{i})$, we
also know that
\begin{equation*}
  \mathcal{L}_{i}(P) \subseteq P_{\con L_{i}}''.
\end{equation*}

Thus, to obtain all elements in $\mathcal{L}_{i}(P) \setminus P_{\con K \div \con
  L_{i}}''$, we can check for all elements $b \in P_{\con L_{i}}'' \setminus P_{\con K
  \div \con L_{i}}$ whether there exists a subset $A \subseteq P$ such that
\begin{equation*}
  1 > \conf_{\con K}(A \to \set{ b }) \ge c.
\end{equation*}
Then $y \in \mathcal{L}_{i}(P) \setminus P_{\con K \div \con L_{i}}''$ if and only if such a
set $A$ exists.

\begin{Proposition}
  \label{prop:computing-confident-closure-first-try}
  Let $\con K = (G, M, I)$ and $\con L_{i} = (G_{i}, M, I)$ be two finite formal contexts
  such that $G$ and $G_{i}$ are disjoint.  Let $c \in [0,1]$ and define
  \begin{equation*}
    \mathcal{L}_{i} = \Th_{c}(\con K) \cap \Th(\con L_{i}).
  \end{equation*}
  Then for $P \subseteq M$ it is true that
  \begin{equation*}
    \mathcal{L}_{i}^{1}(P) = P_{\con K \div \con L_{i}}'' \cup \set{ b \in P_{\con
        L_{i}}'' \mid \exists A \subseteq P \st b \in A_{\con L_{i}}'' \setminus P_{\con K
      \div \con L_{i}}'' \text{ and } \conf_{\con K}(A \to \set{ b }) \ge c }.
  \end{equation*}
\end{Proposition}

Finding sets $A$ as in the previous equation may be quite expensive, as in the worst case
we need to search through all subsets of $P$.  A reduction of the number of sets we have
to consider is thus desirable.  For this we can reuse our previous observation that
\begin{equation*}
  \conf_{\con K}(A \to \set{ b }) = \conf_{\con K}(A_{\con K}'' \to \set{ b }).
\end{equation*}
The idea is now that we use this fact to avoid considering all subsets of $P$, and just
consider only those subsets which are intents of $\con K \div \con L_{i}$.  Note that
since $A \subseteq A_{\con K \div \con L_{i}}'' \subseteq A_{\con K}''$ we also have that
\begin{equation*}
  \conf_{\con K}(A \to \set{ b }) = \conf_{\con K}(A_{\con K \div \con L_{i}}'' \to \set{
    b }).
\end{equation*}
To enumerate all intents of $\con K \div \con L_{i}$ which are subsets of $P$ we could use
the Next Closure algorithm, as discussed in \Cref{sec:bases-implications}.  However, for
this we would need that $A \mapsto A_{\con K \div \con L_{i}}''$ is indeed a closure
operator on $P$, \ie we have to guarantee that $P = P_{\con K \div \con L_{i}}''$ is true.
While this is not true in general, we can easily remedy this issue by computing
$\mathcal{L}_{i}^{1}(P_{\con K \div \con L_{i}}'')$ instead of $\mathcal{L}_{i}^{1}(P)$.

\begin{Proposition}
  \label{prop:computing-confident-closure-second-try}
  Let $\con K = (G, M, I)$ and $\con L_{i} = (G, M, I)$ be two finite formal contexts such
  that $G$ and $G_{i}$ are disjoint.  Let $c \in [0,1]$ and define
  \begin{equation*}
    \mathcal{L}_{i} = \Th_{c}(\con K) \cap \Th(\con L_{i}).
  \end{equation*}
  Define for $P \subseteq M$
  \begin{align*}
    \mathcal{L}_{i}^{1,\conf}(P) &:= P_{\con K \div \con L_{i}}'' \cup \{\, b \in P_{\con
      L_{i}}'' \mid \exists A \subseteq P_{\con K \div \con L_{i}}'' \st A = A_{\con K
      \div \con L_{i}}'', b \in A_{\con L_{i}}'' \setminus
    P_{\con K \div \con L_{i}}''\\ &\hspace*{20em} \text{ and } \conf(A \to \set{b}) \ge c
    \,\}.\\
    \mathcal{L}_{i}^{j+1,\conf}(P) &:=
    \mathcal{L}_{i}^{j,\conf}(\mathcal{L}_{i}^{1,\conf}(P)) \qquad (j \in \NN_{>0}),\\
    \mathcal{L}_{i}^{\conf}(P) &:= \bigcup_{j \in \NN_{>0}} \mathcal{L}_{i}^{j,\conf}(P).
  \end{align*}
  Then
  \begin{equation*}
    \mathcal{L}_{i}^{1,\conf}(P) = \mathcal{L}_{i}^{1}(P_{\con K \div \con L_{i}}'')
  \end{equation*}
  is true for all $P \subseteq M$.  In particular, $\mathcal{L}_{i}^{\conf}(P) =
  \mathcal{L}_{i}(P)$.
\end{Proposition}

Note that the main benefit of $\mathcal{L}_{i}^{\conf}(P)$ over $\mathcal{L}_{i}(P)$ is
that in the former we are allowed to only consider intents of $\con K \div \con L_{i}$
instead of all subsets of $P_{\con K \div \con L_{i}}''$.  This can be done using the Next
Closure algorithm as described above.

\begin{Proof}
  Let $P \subseteq M$, and let $b \in \mathcal{L}_{i}^{1,\conf}(P) \setminus P_{\con K
    \div \con L_{i}}''$.  Then there exists a set $A \subseteq P_{\con K \div \con
    L_{i}}''$ such that $A = A_{\con K \div \con L_{i}}''$, $b \in A_{\con L_{i}}
  \setminus P_{\con K \div \con L_{i}}''$ and $\conf (A \to \set{b}) \ge c$.  Since
  $(P_{\con K \div \con L_{i}}'')_{\con L_{i}}'' = P_{\con L_{i}}''$, the same set $A$
  shows that $b \in \mathcal{L}_{i}^{1}(P_{\con K \div \con L_{i}}'') \setminus P_{\con K
    \div \con L_{i}}''$.

  Conversely, let $b \in \mathcal{L}_{i}^{1}(P_{\con K \div \con L_{i}}'') \setminus
  P_{\con K \div \con L_{i}}''$.  Then $b \in (P_{\con K \div \con L_{i}}'')_{\con
    L_{i}}'' = P_{\con L_{i}}''$.  Furthermore, there exists a set $A \subseteq P_{\con K
    \div \con L_{i}}''$ such that $b \in A_{\con L_{i}}'' \setminus P_{\con K \div \con
    L_{i}}''$ and $\conf_{\con K}(A \to \set{ b }) \ge c$.  Then $\bar A := A_{\con K \div
    \con L_{i}}''$ satisfies $\bar A = \bar A_{\con K \div \con L_{i}}''$, $b \in \bar
  A_{\con L_{i}}'' \setminus P_{\con K \div \con L_{i}}''$ and $\conf_{\con K}(\bar A \to
  \set{b}) \ge c$, thus $b \in \mathcal{L}_{i}^{1,\conf}(P)\setminus P_{\con K \div \con
    L_{i}}''$.

  Finally, because of $\mathcal{L}_{i}^{1,\conf}(P) = \mathcal{L}_{i}^{1}(P_{\con K \div
    \con L_{i}}'')$, we know that
  \begin{equation*}
    \mathcal{L}_{i}^{1}(P) \subseteq \mathcal{L}_{i}^{1,\conf}(P) \subseteq \mathcal{L}_{i}(P),
  \end{equation*}
  and therefore $\mathcal{L}_{i}^{\conf}(P) = \mathcal{L}_{i}(P)$.
\end{Proof}

We can further reduce the search space for the sets $A$ by bounding $\abs A$ from below.
For this we observe that we are looking for sets $A$ such that
\begin{equation*}
  1 > \conf_{\con K}(A \to \set{b}) \ge c.
\end{equation*}
Since $A \to \set{b}$ does not hold in $\con K$, there exists at least one object in
$A_{\con K}'$ that is not contained in $A_{\con K}' \cap \set{b}_{\con K}'$, \ie
\begin{equation*}
  \abs{ A_{\con K}' } > \abs{ A_{\con K}' \cap \set{ b }_{\con K}' }.
\end{equation*}
Moreover, the condition $\conf_{\con K}(A \to \set{b}) \ge c$ entails
\begin{equation*}
  \abs{ A_{\con K}' \cap \set{b}_{\con K}' } \ge c \cdot \abs{A_{\con K}'}.
\end{equation*}
We can therefore infer that $\abs{A_{\con K}'} - 1 \geq c \cdot \abs{A_{\con K}'}$, or
equivalently
\begin{equation}
  \label{eq:64}
  \abs{A_{\con K}'} \geq \frac{1}{1 - c}
\end{equation}
if $c \neq 1$.  Then all sets $A$ which are relevant for the computation of
$\mathcal{L}_{i}^{1}(P)$ or $\mathcal{L}_{i}^{1,\conf}(P)$ satisfy this cardinality
constraint.  Note that for enumerating the sets $A$ that satisfy~\Cref{eq:64}, the Next
Closure algorithm can be modified accordingly, \ie the algorithm can be modified in such a
way that it enumerates only intents contained in $P_{\con K \div \con L_{i}}''$ which
satisfy this cardinality constraint.  See \cite[Theorem~51]{fca-book} for more details on
this.

\subsection{A Non-Approximative Exploration by Confidence}
\label{sec:poss-fast-expl}

\Cref{alg:exploration-by-confidence-first-version} has two main flaws: in general, it only
provides an approximative exploration of $\Th_{c}(\con K)$, and it crucially depends on
the computation of closures under $\Th_{c}(\con K)$.  The latter fact may render the
algorithm practically useless, because computing closures under $\Th_{c}(\con K)$ can be
quite costly.

To achieve an algorithm that indeed implements exploration by confidence, and at the same
time avoids the computation of closures under $\Th_{c}(\con K)$, we shall make use of
\Cref{alg:explore-implications-weaker-version}, our algorithm for exploring sets of
implications that allows for some freedom in the way implications are asked to the expert.
To apply this algorithm to our specific setting, the main problem we have to solve is how
to decide whether a given set $P \subseteq M$ is closed under $\Th_{c}(\con K)$ or not.
Furthermore, we need to define the way the sets $P_{i+1}$ and $Q$ are computed, which
eventually will constitute the implication $P_{i+1} \to Q$ which is asked to the expert.
As it turns out, we can define the set $Q$ in such a way that $P_{i+1} \to Q$ will always
have at least confidence $c$ in $\con K$.

Let us start with some wishful thinking.  To decide whether $P$ is closed under
$\mathcal{L}_{i} = \Th_{c}(\con K) \cap \Th(\con L_{i})$ it would be ideal if we could
just check whether no element in $P_{\con L_{i}}''$ is entailed by $P$ with confidence at
least $c$, \ie
\begin{equation}
  \label{eq:43}
  P = \mathcal{L}_{i}(P) \iff \forall m \in P_{\con L_{i}}'' \setminus P \holds
  \conf_{\con K}(P \to \set{m}) < c.
\end{equation}
The main benefit would be that we would not need to consider all subsets of $P$, and thus
could avoid this expensive search.

Regrettably, \Cref{eq:43} is not valid in general, but only the direction from left to
right holds.  However, we can identify a special case in which this equivalence holds.

\begin{Proposition}
  \label{prop:easy-checking-confidence-closed}
  Let $\con K = (G, M, I)$ be a finite formal context, and let $c \in [0,1]$.  Let $\con
  L_{i} = (G_{i}, M, I)$ be another finite formal context such that $G_{i}$ and $G$ are
  disjoint, and define $\mathcal{L}_{i} = \Th_{c}(\con K) \cap \Th(\con L_{i})$.  Let $A
  \subseteq M$ be such that for every intent $X \subsetneq A$ of $\con K \div \con L_{i}$
  it is true that
  \begin{equation}
    \label{eq:44}
    \forall m \in X_{\con L_{i}}'' \holds \conf_{\con K}(X \to \set{m}) \ge c \implies m
    \in \mathcal{K}_{i}(X).
  \end{equation}
  In addition, let $A$ be $\mathcal{K}_{i}$-closed.  Then it is true that $A$ is
  $\mathcal{L}_{i}$-closed if and only if
  \begin{equation}
    \label{eq:45}
    A = A_{\con K \div \con L_{i}}'' \text{ and } \forall m \in A_{\con L_{i}}'' \setminus
    A \holds \conf_{\con K}(A \to \set{m}) < c.
  \end{equation}
\end{Proposition}
\begin{Proof}
  Let $A$ be $\mathcal{L}_{i}$-closed.  Since $A \to A_{\con K \div \con L_{i}}''$ is
  valid in both $\con K$ and $\con L_{i}$, it is true that $(A \to A_{\con K \div \con
    L_{i}}'') \in \mathcal{L}_{i}$.  Therefore, $A = \mathcal{L}_{i}(A) \supseteq A_{\con
    K \div \con L_{i}}'' \supseteq A$ and thus $A = A_{\con K \div \con L_{i}}''$ holds.
  If $m \in A_{\con L_{i}}''$ is such that $\conf_{\con K}(A \to \set{m}) \ge c$, then $(A
  \to \set{m}) \in \mathcal{L}_{i}$ and therefore $m \in \mathcal{L}_{i}(A) = A$ as
  required.

  Conversely, suppose that $A$ is not closed under $\mathcal{L}_{i}$ and that $A = A_{\con
    K \div \con L_{i}}''$ is true.  Then there exists a set $X \subseteq A$ and an
  attribute $m \in A_{\con L_{i}}'' \setminus A$ such that $(X \to \set{m}) \in
  \mathcal{L}_{i}$.  Note that then $m \in X_{\con L_{i}}''$, because $X \to \set{m}$
  holds in $\con L_{i}$.  Since $A = A_{\con K \div \con L_{i}}''$, $X \subseteq A$
  implies $X_{\con K \div \con L_{i}}'' \subseteq A$.  Assume by contradiction that
  $X_{\con K \div \con L_{i}}'' \subsetneq A$.  Then $\conf_{\con K}(X_{\con K \div \con
    L_{i}}'' \to \set{m}) = \conf_{\con K}(X \to \set{m}) \ge c$ and \Cref{eq:44} implies
  \begin{equation*}
    m \in \mathcal{K}_{i}(X_{\con K \div \con L_{i}}'') \subseteq \mathcal{K}_{i}(A) = A,
  \end{equation*}
  a contradiction.  Therefore, $X_{\con K \div \con L_{i}}'' = A$ and thus $m \in A_{\con
    L_{i}}'' \setminus A$ satisfies $\conf_{\con K}(A \to \set{m}) \ge c$ as required.
\end{Proof}

Using the same notation as in \Cref{alg:explore-implications-weaker-version}, the idea is
now to instantiate this algorithm such that \Cref{eq:44} is satisfied whenever we have to
test a $\mathcal{K}_{i}$-closed set $A \subseteq M$ for being closed under
$\mathcal{L}_{i}$.  To achieve this, we shall ask additional questions: in addition to
asking the expert implications $P_{i+1} \to Q$ where $P_{i+1}$ is
$\mathcal{K}_{i}$-closed, we shall also ask questions $X \to \set{m}$, where $X$ is an
intent of $\con K \div \con L_{i}$, $\con L_{i}$ is the formal context constituted of the
counterexamples given so far, and $m \in X_{\con L_{i}}'' \setminus \mathcal{K}_{i}(X)$
satisfies $\conf_{\con K}(X \to \set{m}) \ge c$.

\addfunctionname{exploration-by-confidence*}

\begin{figure}[tp]
  \begin{Algorithm}[Exploration by Confidence]
    \label{alg:exploration-by-confidence-without-Th_c(K)-closures}
    \hspace*{0cm}
\begin{lstlisting}
define exploration-by-confidence*($\con K = (G, M, I)$, $\leq_M$, $p$, $c \in [0,1]$, $\mathcal{K} \subseteq \Th(p) \cap \Th_{c}(\con K)$)
  $i$ := 0, $\con L_{i} = (\emptyset, M, \emptyset)$, $\mathcal{K}_i$ := $\mathcal{K}$, $P_i$ := $\emptyset$

  forever do
    $P_{i+1}^{1}$ := $\text{lectically smallest intent } P \text{ of } \con K \div \con L_{i} \text{ such that }$
      - $P_{i} \preceq P \text{, and}$
      - $\text{there exists } m \in P_{\con L_{i}}'' \setminus \mathcal{K}_{i}(P) \text{ such that } \conf_{\con K}(P \to \set{m}) \ge c$
      $\text{or }$ nil $\text{ if such a set does not exist}$
    $Q_{i+1}^{1}$ := $P_{i+1}^{1} \cup \set{ m }$ ;; $m$ from above

    $P_{i+1}^{2}$ := next-closed-non-closed($M$, $\leq_{M}$, $P_{i}$, $\mathcal{K}_{i}$, $\con K \div \con L_{i}$)
    $Q_{i+1}^{2}$ := $(P_{i+1}^{2})_{\con K \div \con L_{i}}''$

    $P_{i+1}$ := $\min\nolimits_{\preceq}(P_{i+1}^{1}, P_{i+1}^{2})$ ;; $\text{\textup{\textbf{nil}}}$ maximal with respect to $\preceq$
    if $P_{i+1} =$ nil exit

    if $P_{i+1} = P_{i+1}^{1}$ then
      $Q_{i+1}$ := $Q_{i+1}^{1}$
    else
      $Q_{i+1}$ := $Q_{i+1}^{2}$
    end

    if $p(P_{i+1} \to Q_{i+1}) = \top$ then
      $\mathcal{K}_{i+1}$ := $\mathcal{K}_i \cup \set{ P_{i+1} \to Q_{i+1} }$
      $\con L_{i+1}$ := $\con L_{i}$
    else
      $\mathcal{K}_{i+1}$ := $\mathcal{K}_i$
      $\con L_{i+1}$ := $\con L_{i} + p(P_{i+1} \to Q_{i+1})$ ;; add counterexample to $\con L_{i}$
    end

    $i$ := $i + 1$
  end

  return $\mathcal{K}_i$
end
\end{lstlisting}
  \end{Algorithm}
\end{figure}

This idea is realized in \Cref{alg:exploration-by-confidence-without-Th_c(K)-closures}.
Instead of computing the set $P_{i+1}$ directly, we compute there two candidates
$P_{i+1}^{1}$ and $P_{i+1}^{2}$.  Here, $P_{i+1}^{2}$ is the \enquote{usual} premise we
compute for exploration.  On the other hand, the idea of considering the sets
$P_{i+1}^{1}$ comes from \Cref{eq:44} in \Cref{prop:easy-checking-confidence-closed}: if
we are in iteration $i$, then all intents $X \subsetneq P_{i}$ of $\con K \div \con L_{i}$
had been considered as sets $X = P_{j}^{1}$ for some $j < i$, since $X \subsetneq P_{i}$
implies $X \precneq P_{i}$.  Then for all $m \in X_{\con L_{i}}'' \setminus
\mathcal{K}_{i}(X)$ satisfying $\conf_{\con K}(X \to \set{m}) \ge c$, the implication $X
\to \set{m}$ has been asked to the expert.  If confirmed, the implication is contained in
$\mathcal{K}_{i}$; if rejected, the context $\con L_{i}$ would contain a counterexample,
and thus $m \notin (P_{i})_{\con L_{i}}''$.  In this way, the condition in \Cref{eq:44} is
ensured.

That this rather informal argumentation indeed holds for
\Cref{alg:exploration-by-confidence-without-Th_c(K)-closures} is shown in the following
proposition.

\begin{Proposition}
  \label{prop:exploration-by-confidence-crucial-condition-holds}
  Suppose that we are in iteration $i$ of
  \Cref{alg:exploration-by-confidence-without-Th_c(K)-closures}.  Then for all intents $X
  \precneq P_{i}$ of $\con K \div \con L_{i}$ it is true that
  \begin{equation}
    \label{eq:42}
    \forall m \in X_{\con L_{i}}'' \holds \conf_{\con K}(X \to \set{m}) \ge c \implies m
    \in \mathcal{K}_{i}(X).
\end{equation}
\end{Proposition}
\begin{Proof}
  We show the claim by induction over $i$.  For the base case $i = 0$ the claim is vacuously
  true since $P_{0} = \emptyset$.  For the step case assume that \Cref{eq:42} holds for
  iteration $i$, and assume further that iteration $i+1$ exists.  Then to show the claim
  for iteration $i+1$ let $X \precneq P_{i+1}$ be an intent of $\con K \div \con L_{i+1}$
  and $m \in X_{\con L_{i}}''$ such that $\conf_{\con K}(X \to \set{m}) \ge c$. We need to
  show that $m \in \mathcal{K}_{i}(X)$ is true.  For this, we distinguish two cases.

  \textit{Case $X \precneq P_{i}$}: If $\con L_{i} = \con L_{i+1}$, then $X$ being an
  intent of $\con K \div \con L_{i+1}$ also trivially means that $X$ is an intent of $\con
  K \div \con L_{i}$.  By induction hypothesis, we obtain $m \in \mathcal{K}_{i}(X)
  \subseteq \mathcal{K}_{i+1}(X)$ as required.

  If $\con L_{i} \neq \con L_{i+1}$, then a counterexample $C \subseteq M$ has been added
  to $\con L_{i}$ to obtain $\con L_{i+1}$, \ie
  \begin{equation*}
    \con L_{i+1} = \con L_{i} + C.
  \end{equation*}
  The set $C$ is a counterexample to the implication $P_{i+1} \to Q_{i+1}$, and because of
  this, $P_{i+1} \subseteq C$ is true.  Thus, $X \precneq P_{i+1} \preceq C$.  Therefore,
  $C \not\subseteq X$, and it follows that $X_{\con L_{i+1}}'' = X_{\con L_{i}}''$.  Since
  $X$ is an intent of $\con K \div \con L_{i+1}$, this implies that $X$ is also an intent
  of $\con K \div \con L_{i}$.  Again by induction hypothesis we obtain that $m \in
  \mathcal{K}_{i}(X) = \mathcal{K}_{i+1}(X)$.

  \textit{Case $P_{i} \preceq X \precneq P_{i+1}$} (note that this case may not occur if
  $P_{i} = P_{i+1}$): As argued before, $X$ being an intent of $\con K \div \con L_{i+1}$
  implies that $X$ is also an intent of $\con K \div \con L_{i}$.  Since $X \precneq
  P_{i+1} \preceq P_{i+1}^{1}$, and $P_{i+1}^{1}$ is the lectically smallest intent of
  $\con K \div \con L_{i}$ such that there exists an element $n \in (P_{i+1}^{1})_{\con
    L_{i}}'' \setminus \mathcal{K}_{i}(P_{i+1}^{1})$ satisfying $\conf_{\con
    K}(P_{i+1}^{1} \to \set{n}) \ge c$, it follows that $m \in \mathcal{K}_{i}(X)$, as
  required.
\end{Proof}

To show that \Cref{alg:exploration-by-confidence-without-Th_c(K)-closures} indeed yields
an algorithm that implements exploration by confidence we shall show that it has the form
of \Cref{alg:explore-implications-weaker-version}.  For this we need to show that in every
iteration $i$, the lectically smallest $\mathcal{K}_{i}$-closed, not
$\mathcal{L}_{i}$-closed set $P$ with $P_{i} \preceq P$ satisfies
\begin{equation}
  \label{eq:46}
  P_{i} \preceq P_{i+1} \preceq P.
\end{equation}
Additionally, we need to show that $P_{i+1}$ is not $\mathcal{L}_{i}$-closed, and
$Q_{i+1}$ satisfies
\begin{equation}
  \label{eq:47}
  P_{i+1} \subsetneq Q \subseteq \mathcal{L}_{i}(P_{i+1}), Q \not\subseteq \mathcal{K}_{i}(P_{i+1}).
\end{equation}
This is enough, as the rest of
\Cref{alg:exploration-by-confidence-without-Th_c(K)-closures} has the same structure as
\Cref{alg:explore-implications-weaker-version}.

We first show that \Cref{eq:46} is true.  The fact that $P_{i} \preceq P_{i+1}$ is clear,
and $P_{i+1} \preceq P$ is shown in the following proposition.
\begin{Proposition}
  \label{prop:exploration-by-confidence-first-condition-holds}
  Suppose that we are in iteration $i$ of
  \Cref{alg:exploration-by-confidence-without-Th_c(K)-closures}.  Let $P \subseteq M$ be
  the lectically smallest $\mathcal{K}_{i}$-closed set lectically greater or equal to
  $P_{i}$ which is not $\mathcal{L}_{i}$-closed.  Then $P_{i+1} \preceq P$.
\end{Proposition}
\begin{Proof}
  We first observe that $P_{i+1}^{2}$ is $\mathcal{K}_{i}$-closed by definition, but not
  $\mathcal{L}_{i}$-closed, since
  \begin{equation*}
    (P_{i+1}^{2})_{\con K \div \con L_{i}}'' \neq P_{i+1}^{2}
  \end{equation*}
  because of $\Th(\con K \div \con L_{i}) \subseteq \mathcal{L}_{i}$.  This implies $P
  \preceq P_{i+1}^{2}$, and the claim holds if $P = P_{i+1}^{2}$.

  It remains to consider the case $P \precneq P_{i+1}^{2}$.  In this case, by construction
  of $P_{i+1}^{2}$ and since $P$ is $\mathcal{K}_{i}$-closed, the set $P$ must be an
  intent of $\con K \div \con L_{i}$.  Since $P$ is not $\mathcal{L}_{i}$-closed, there
  must exist a set $\overline P \subseteq P$ and an element $m \in P_{\con L_{i}}''
  \setminus P$ such that
  \begin{equation*}
    \conf_{\con K}(\overline P \to \set{m}) \ge c,
  \end{equation*}
  and $\overline P \to \set{m}$ is valid in $\con L_{i}$.  In particular, $m \in \overline
  P_{\con L_{i}}'' \setminus \mathcal{K}_{i}(\overline P)$.

  Since $P$ is an intent of $\con K \div \con L_{i}$ we can assume that $\overline P$ is
  also an intent of $\con K \div \con L_{i}$.  If $\overline P \precneq P_{i}$, then by
  \Cref{prop:exploration-by-confidence-crucial-condition-holds} it would be true that $m
  \in \mathcal{K}_{i}(\overline P) \subseteq \mathcal{K}_{i}(P) = P$, a contradiction.
  Therefore, $P_{i} \preceq \overline P$.  By definition of $P_{i+1}^{1}$ it holds that
  $P_{i+1}^{1} \preceq \overline P$, and thus $P_{i+1}^{1} \preceq \overline P \preceq P$,
  because $\overline P \subseteq P$.  Thus, $P_{i+1} \preceq P$, as required.
\end{Proof}

Furthermore, it is easy to see that $P_{i+1}$ is not $\mathcal{L}_{i}$-closed: if $P_{i+1}
= P_{i+1}^{1}$, then the element $m$ found during this computation satisfies $m \in
\mathcal{L}_{i}(P_{i+1}) \setminus P_{i+1}$.  If $P_{i+1} = P_{i+1}^{2}$, then
$P_{i+1}^{2} \neq (P_{i+1}^{2})_{\con K \div \con L_{i}}''$ shows that $P_{i+1}$ is not
$\mathcal{L}_{i}$-closed.

It remains to show that $Q_{i+1}$ satisfies \Cref{eq:47}, \ie
\begin{equation*}
  P_{i+1} \subsetneq Q_{i+1} \subseteq \mathcal{L}_{i}(P_{i+1}).
\end{equation*}
To see this, first suppose that $P_{i+1} = P_{i+1}^{1}$.  Then $Q$ contains an attribute
$m$ that satisfies $m \notin \mathcal{K}_{i}(P_{i+1}) \supseteq P_{i+1}$.  In this case,
$\conf_{\con K}(P_{i+1}^{1} \to \set{m}) \ge c$ and $m \in P_{\con L_{i}}''$, thus
$(P_{i+1} \to \set{m}) \in \mathcal{L}_{i}$ and $Q_{i+1} \subseteq
\mathcal{L}_{i}(P_{i+1})$.  On the other hand, if $P_{i+1} = P_{i+1}^{2}$, then $P_{i+1}
\neq (P_{i+1})_{\con K \div \con L_{i}}'' = Q_{i+1}$.  Since $\Th(\con K \div \con L_{i})
\subseteq \mathcal{L}_{i}$, $Q_{i+1} \subseteq \mathcal{L}_{i}(P_{i+1})$ is true.
Finally, $Q_{i+1} \not\subseteq \mathcal{K}_{i}(P_{i+1}^{2})$ is clear since
$\mathcal{K}_{i}(P_{i+1}^{2}) = P_{i+1}^{2}$ and $Q \not\supseteq P_{i+1}^{2}$.

We have thus shown that \Cref{alg:exploration-by-confidence-without-Th_c(K)-closures} has
the form of \Cref{alg:explore-implications-weaker-version}.  The following result is then
an immediate consequence of \Cref{thm:explore-implications-weaker-version-termination} and
\Cref{thm:explore-implications-weaker-version-all-other-properties}.  Note that our
algorithm only asks implications which are either valid in $\con K$, or at least have
confidence at least $c$ in $\con K$.  Thus, $\mathcal{K}_{i} \setminus \mathcal{K}
\subseteq \Th_{c}(\con K)$ holds in every iteration $i$.  Therefore, in contrast to
\Cref{alg:exploration-by-confidence-first-version},
\Cref{alg:exploration-by-confidence-without-Th_c(K)-closures} always computes a base of
$\Th(p) \cap \Th_{c}(\con K)$.

\begin{Corollary}
  \label{cor:exploration-by-confidence-weaker-version-properties}
  Let $\con K = (G, M, I)$ be a finite formal context, $\leq_{M}$ a linear order on $M$,
  $p$ a domain expert on $M$, $c \in [0,1]$ and $\mathcal{K} \subseteq \Th(p) \cap
  \Th_{c}(\con K)$.  Then \Cref{alg:exploration-by-confidence-without-Th_c(K)-closures}
  applied to this input terminates after finitely many steps.  If $n$ is the number of
  iterations of this run, then $\mathcal{K}_{n} \setminus \mathcal{K}$ is a confident base
  of $\Th(p) \cap \Th_{c}(\con K)$ with background knowledge $\mathcal{K}$, \ie
  $\mathcal{K}_{n} \setminus \mathcal{K} \subseteq \Th_{c}(\con K)$ and
  \begin{equation*}
    \Cn(\mathcal{K}_{n}) = \Cn(\Th(p) \cap \Th_{c}(\con K)).
  \end{equation*}
  If $\con L$ is the formal context that consists of all counterexamples provided by $p$
  during the exploration, then for each $(A \to B) \in \Th_{c}(\con K)$ it is true that
  either $(A \to B) \in \Cn(\mathcal{K}_{n})$ or $(A \to B) \notin \Th(\con L)$.
\end{Corollary}

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

%  LocalWords:  expl attr gener approximative