\section{Isabelle/HOL}
\label{sec:isabelle}

\index{Isabelle proof assistant}

When using Isabelle from \why, files generated from \why theories and
goals are stored in a dedicated XML format. Those files should not be
edited. Instead, the proofs must be completed in a file with the same
name and extension \texttt{.thy}. This is the file that is opened when
using ``Edit'' action in \texttt{why3 ide}.

\subsection{Installation}

You need version Isabelle2017 or Isabelle2018. Former versions are not
supported. We assume below that your version is 2018, please replace
2018 by 2017 otherwise.

Isabelle must be installed before compiling \why. After compilation
and installation of \why, you must manually add the path
\begin{verbatim}
<Why3 lib dir>/isabelle
\end{verbatim}
into either the user file
\begin{verbatim}
.isabelle/Isabelle2018/etc/components
\end{verbatim}
or the system-wide file
\begin{verbatim}
<Isabelle install dir>/etc/components
\end{verbatim}

\subsection{Usage}

The most convenient way to call Isabelle for discharging a \why goal
is to start the Isabelle/jedit interface in server mode. In this mode,
one must start the server once, before launching \texttt{why3 ide},
using
\begin{verbatim}
isabelle why3_jedit
\end{verbatim}
Then, inside a \texttt{why3 ide} session, any use of ``Edit'' will
transfer the file to the already opened instance of jEdit. When the
proof is completed, the user must send back the edited proof to
\texttt{why3 ide} by closing the opened buffer, typically by hitting
\texttt{Ctrl-w}.

\subsection{Using Isabelle 2018 server}

Starting from Isabelle version 2018, Why3 is able to exploit the
server features of Isabelle to speed up the processing of proofs in
batch mode, e.g. when replaying them from within Why3 IDE. Currently,
when replaying proofs using the \verb|isabelle why3| tool, an Isabelle
process including a rather heavyweight Java/Scala and PolyML runtime
environment has to be started, and a suitable heap image has to be
loaded for each proof obligation, which can take several seconds. To
avoid this overhead, an Isabelle server and a suitable session can be
started once, and then \verb|isabelle why3| can just connect to it and
request the server to process theories. In order to allow a tool such
as Why3 IDE to use the Isabelle server, it has to be started via the
wrapper tool \verb|isabelle use_server|. For example, to process the proofs
in examples/logic/genealogy using Why3 IDE and the Isabelle server, do
the following:
\begin{enumerate}
\item Start an Isabelle server using
\begin{verbatim}
   isabelle server &
\end{verbatim}
\item Start Why3 IDE using
\begin{verbatim}
   isabelle use_server why3 ide genealogy
\end{verbatim}
\end{enumerate}

 \subsection{Realizations}

Realizations must be designed in some \texttt{.thy} as follows.
The realization file corresponding to some \why file \texttt{f.why}
should have the following form.
\begin{verbatim}
theory Why3_f
imports Why3_Setup
begin

section {* realization of theory T *}

why3_open "f/T.xml"

why3_vc <some lemma>
<proof>

why3_vc <some other lemma> by proof

[...]

why3_end
\end{verbatim}

See directory \texttt{lib/isabelle} for examples.


%%% Local Variables:
%%% mode: latex
%%% TeX-PDF-mode: t
%%% TeX-master: "manual"
%%% End:
