\subsection{Coq Tactic}
\label{sec:coqtactic}

\why provides a Coq tactic to call external theorem provers as oracles.

\subsubsection{Installation}

You need Coq version 8.4 or greater. If this is the case, \why's
configuration detects it, then compiles and installs the Coq tactic.
The Coq tactic is installed in
\begin{center}
  \textit{why3-lib-dir}\texttt{/coq-tactic/}
\end{center}
where \textit{why3-lib-dir} is \why's library directory, as reported
by \verb+why3 --print-libdir+. This directory
is automatically added to Coq's load path if you are
calling Coq via \why (from \texttt{why3 ide}, \texttt{why3 replay},
etc.). If you are calling Coq by yourself, you need to add
this directory to Coq's load path, either using Coq's command line
option \texttt{-I} or by adding
\begin{center}
  \verb+Add LoadPath "+\textit{why3-lib-dir}\verb+/coq-tactic/".+
\end{center}
to your \texttt{\~{}/.coqrc} resource file.

\subsubsection{Usage}

The Coq tactic is called \texttt{why3} and is used as follows:
\begin{center}
  \texttt{why3} \verb+"+\textit{prover-name}\verb+"+
  $[$\texttt{timelimit} \textit{n}$]$.
\end{center}
The string \textit{prover-name} identifies one of the automated theorem provers
supported by \why, as reported by \verb+why3 --list-provers+
(interactive provers excluded).
\index{list-provers@\verb+--list-provers+}
The current goal is then translated to \why's logic and the prover is
called. If it reports the goal to be valid, then Coq's \texttt{admit}
tactic is used to assume the goal. The prover is called with a time
limit in seconds as given by \why's configuration file
(see Section~\ref{sec:whyconffile}). A different value may be given
using the \texttt{timelimit} keyword.

\subsubsection{Error messages.} The following errors may be reported by
the Coq tactic.
\begin{description}
\item[\texttt{Not a first order goal}]\emptyitem
  The Coq goal could not be translated to \why's logic.
\item[\texttt{Timeout}]\emptyitem
  There was no answer from the prover within the given time limit.
\item[\texttt{Don't know}]\emptyitem
  The prover stopped without validating the goal.
\item[\texttt{Invalid}]\emptyitem
  The prover stopped, reporting the goal to be invalid.
\item[\texttt{Failure}]\emptyitem
  The prover failed. Depending on the message that follows, you may
  want to file a bug report, either to the \why\ developers or to the
  prover developers.
\end{description}

%%% Local Variables:
%%% mode: latex
%%% compile-command: "make -C .. doc"
%%% TeX-PDF-mode: t
%%% TeX-master: "manual"
%%% End:
