You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/hydra-chapter.tex
+27-29Lines changed: 27 additions & 29 deletions
Original file line number
Diff line number
Diff line change
@@ -112,7 +112,7 @@ \subsection{The rules of the game}
112
112
Thus, the replication process will be represented as a binary relation on a data type \texttt{Hydra},
113
113
linking the state of the hydra \emph{before} and \emph{after} the transformation.
114
114
A battle will thus be represented as a sequence of terms of type \texttt{Hydra}, respecting the rules of the game.
115
-
115
+
In other terms, we consider hydra battles as \emph{transition systems}.
116
116
117
117
118
118
@@ -154,7 +154,7 @@ \subsection{Example}
154
154
\end{figure}
155
155
156
156
157
-
\begin{figure}[hp]
157
+
\begin{figure}[h]
158
158
\centering
159
159
\begin{tikzpicture}[very thick, scale=0.5]
160
160
@@ -179,7 +179,7 @@ \subsection{Example}
179
179
\label{fig:Hy2}
180
180
\end{figure}
181
181
182
-
\begin{figure}[hp]
182
+
\begin{figure}[h]
183
183
\centering
184
184
\begin{tikzpicture}[very thick, scale=0.6]
185
185
@@ -221,7 +221,7 @@ \subsection{Example}
221
221
222
222
Figs.~\ref{fig:Hy4} and~\vref{fig:Hy5} represent a possible third round of the battle, with a replication factor equal to $2$. Let us call \texttt{Hy'''} the state of the hydra after that third round.
223
223
224
-
\begin{figure}[hp]
224
+
\begin{figure}[h]
225
225
\centering
226
226
\begin{tikzpicture}[very thick, scale=0.6]
227
227
@@ -262,7 +262,7 @@ \subsection{Example}
262
262
\caption{A third beheading (wounded part in red) \label{fig:Hy4}}
263
263
\end{figure}
264
264
265
-
\begin{figure}[hp]
265
+
\begin{figure}[h]
266
266
\centering
267
267
\begin{tikzpicture}[very thick, scale=0.4]
268
268
@@ -415,9 +415,7 @@ \section{Hydras and their representation in \emph{Coq}}
Using this representation, one can re-define all the constructions of this chapter, which is left as an exercise.
418
-
You will probably have to use patterns described for instance in~\cite{BC04} or the archives of the \coq communication channels (please consult~\url{https://coq.inria.fr/community.html}).
419
-
420
-
418
+
You will probably have to use patterns described for instance in~\cite{BC04, BC04ch14} or the archives of the \coq communication channels (please consult~\url{https://coq.inria.fr/community.html}).
\subsection{Binary relation associated with a round}
699
697
700
-
Let us merge \texttt{R1} and \texttt{R1} into a single relation.
698
+
Let us merge \texttt{R1} and \texttt{R2} into a single relation.
701
699
First, we define the relation \texttt{(round\_n n h h')} where \texttt{n} is the expected number of replications (irrelevant in the case of an \texttt{R1}-transformation).
702
700
Then, we define a \emph{round} (small step) of a battle
703
701
by abstraction over \texttt{n},
@@ -731,13 +729,6 @@ \subsection{Rounds and battles}
the height of $h'$ is less or equal than the height of $h$.
739
-
740
-
\end{exercise}
741
732
742
733
\begin{remark}
743
734
\label{remark:transitive-closure}
@@ -763,6 +754,12 @@ \subsection{Rounds and battles}
763
754
The same remark also holds for reflexive and transitive closures.
764
755
\end{remark}
765
756
757
+
\index{hydras}{Exercises}
758
+
\begin{exercise}
759
+
Prove that if \texttt{$h$ -+-> $h'$}, then
760
+
the height of $h'$ is less or equal than the height of $h$.
761
+
762
+
\end{exercise}
766
763
\index{hydras}{Exercises}
767
764
768
765
\begin{exercise}
@@ -1007,9 +1004,9 @@ \subsection{Looking for regularities}
1007
1004
1008
1005
\subsection{Testing \dots}
1009
1006
\label{sect:testing}
1010
-
In order to study \emph{experimentally} the different configurations of the battle, we will use a simple data type for representing the states as tuples composed of
1011
-
the round number, and the respective number of daughters \texttt{h2}, \texttt{h1}, and heads
1012
-
of the current hydra.
1007
+
In order to make the study of this battle easier, we will use a simple data type for representing a configuration
1008
+
$(\textit{round}, \texttt{hyd}\;n_2\;n_1\; n_h)$ as the $4$-tuple
1009
+
1013
1010
1014
1011
1015
1012
\input{movies/snippets/BigBattle/stateDef}
@@ -1039,7 +1036,7 @@ \subsection{Testing \dots}
1039
1036
\input{movies/snippets/BigBattle/testDefTests}
1040
1037
1041
1038
The battle we are studying looks to be awfully long. Let us concentrate our
1042
-
tests on some particular events : the states where $\texttt{nh}=0$.
1039
+
tests on some particular events : the states where $n_h=0$.
1043
1040
From the value of \texttt{test 5}, it is obvious that at the 10-th round, the counter \texttt{nh} is equal to zero.
1044
1041
1045
1042
@@ -1068,7 +1065,8 @@ \subsection{Proving \dots}
1068
1065
We are now able to reason about the sequence of transitions defined by our hydra battle.
1069
1066
1070
1067
Let us define a binary relation associated with every round of the battle.
1071
-
In the following definition \texttt{i} is associated with the round number (or date, if we consider a discrete time), and \texttt{a}, \texttt{b}, \texttt{c} respectively associated with the number of occurrences of \texttt{h2}, \texttt{h1} and heads connected to the hydra's foot. For convenience, we do not use the type \texttt{state} of the preceding section, but consider the round numbers and the number of hydras \texttt{h2}, \texttt{h1} and heads as separate arguments of the relation (which is no more ---formally--- ``binary'').
1068
+
In the following definition \texttt{i} is associated with the round number (or date, if we consider a discrete time), and \texttt{a}, \texttt{b}, \texttt{c} respectively associated with the number of occurrences of \texttt{h2}, \texttt{h1} and heads connected to the hydra's foot. For convenience\footnote{In a few words, the type \texttt{state} was designed for performing \emph{computations}, and \texttt{steps} for writing \emph{interactive proofs}, inspired by the aforementionned computations.},
1069
+
we do not use the type \texttt{state} of the preceding section, but consider the round numbers and the number of hydras \texttt{h2}, \texttt{h1} and heads as separate arguments of the relation (which is no more ---formally--- ``binary'').
1072
1070
1073
1071
\input{movies/snippets/BigBattle/oneStep}
1074
1072
@@ -1088,7 +1086,7 @@ \subsection{Proving \dots}
1088
1086
1089
1087
1090
1088
1091
-
The following lemma establishes a relation between \texttt{steps} and the predicate \texttt{battle}.
1089
+
The following lemma establishes a relation between \texttt{steps} and the predicate \texttt{rounds}.
The number $N$ is greater than or equal to $2^{2^{95}\times 95}.$ If we wrote$N$ in base $10$, $N$ would require at least $10^{30}$ digits!
1249
+
The number $N$ is greater than or equal to $2^{2^{95}\times 95}.$ If we write$N$ in base $10$, $N$ would require at least $10^{30}$ digits!
1252
1250
1253
1251
1254
1252
\section{Generic properties}
@@ -1331,7 +1329,7 @@ \subsection{A small proof of impossibility}
1331
1329
one has to consider first a well-founded set $(A,<)$, then a strictly decreasing measure on this set. The following lemma shows that, if the order structure $(A,<)$ is too simple, it is useless to look for a convenient measure, which simply no exists. Such kind of result is useful, because it saves you time and effort.
1332
1330
1333
1331
1334
-
The best known well-founded order is the natural order on the set $\mathbb{N}$ of natural numbers (the type \texttt{nat} of Standard library). It would be interesting to look for some measure $m:\texttt{nat}\arrow\texttt{nat}$ and prove it is a variant.
1332
+
The best known well-founded order is the natural order on the set $\mathbb{N}$ of natural numbers (the type \texttt{nat} of Standard Library). It would be interesting to look for some measure $m:\texttt{nat}\arrow\texttt{nat}$ and prove it is a variant.
1335
1333
1336
1334
Unfortunately, we can prove that
1337
1335
\emph{no} instance of class (\texttt{WfVariant round Peano.lt $m$}) can be built, where
Copy file name to clipboardExpand all lines: doc/hydras.tex
+25-10Lines changed: 25 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -207,6 +207,13 @@ \section{Generalities}
207
207
necessary. Since the development of a theory is represented as a bunch of computer files,
208
208
everyone is able to read the proofs with an arbitrary level of detail, or to play with the theory by writing alternate proofs or definitions.
209
209
210
+
If a formal development is large (at least 10 KLOCs), we believe that a human-readable document containing explanations, diagrams, code snippets, examples, exercises, etc.) would be useful
211
+
for a better understanding of both the mathematical contents
212
+
and the formalization techniques used in the
213
+
development~\cite{Chiplunkar23}.
214
+
215
+
This document has been generated with \alectr (see Sect.~\vref{sect:alectryon-intro}), which ensures the \texttt{pdf} is consistent with the last compiled version of the \coq project.
216
+
210
217
211
218
Among all the theorems proved with the help of proof assistants like \coq{}~\cite{Coq,BC04}, \hol{}~\cite{HOL}, \isabelle{}~\cite{isabelle}, etc.,
212
219
several statements and proofs share some interesting features:
@@ -331,6 +338,7 @@ \section{Generalities}
331
338
332
339
333
340
\subsection{Documenting theories with \alectr}
341
+
\label{sect:alectryon-intro}
334
342
335
343
Quotations of \coq source and answers are progressively replaced from copy-pasted \emph{verbatim} to automatically generated \emph{LaTeX} blocks, using Clément Pit-Claudel's \alectr tool~\cite{alectryonpaper, alectryongithub}.
336
344
Many thanks to Jérémy Damour, Clément Pit-Claudel and Théo Zimmermann who designed tools for maintaining consistency between the always evolving \coq{} modules and documentation written in \emph{LaTeX}.
@@ -341,8 +349,8 @@ \subsection{Trust in our proofs}
341
349
\label{sect:trust-in-proofs}
342
350
343
351
Unlike mathematical literature, where definitions and proofs are spread out over many articles and books,
344
-
the whole proof is now inside your computer. It is composed from the \texttt{.v} files you downloaded and
345
-
parts of \coq's standard library. Thus, there is no ambiguity in our definitions and the premises of the theorems. Furthermore, you will be able to navigate through the development, using your favorite text editor or IDE, and some commands like \texttt{Search}, \texttt{Locate}, etc.
352
+
the whole proof is now inside your computer. It is composed from the \texttt{.v} files you downloaded,
353
+
parts of \coq's standard library, and required \coq packages (see Fig.~\vref{fig:genealogy}). Thus, there is no ambiguity in our definitions and the premises of the theorems. Furthermore, you will be able to navigate through the development, using your favorite text editor or IDE, and some commands like \texttt{Search}, \texttt{Locate}, etc.
In general, we do not include full proof scripts in this document. The only exceptions are very short proofs (\emph{e.g.}, proofs by computation, or by application of automatic tactics). Likewise, we may display only the important steps on a long interactive proof, for instance, in the following lemma (\vref{lemma:L-2_6-1}):
@@ -479,7 +494,7 @@ \subsection{Alternative or bad definitions}
479
494
480
495
\section{How to install the libraries}
481
496
\label{sec:orgheadline4}
482
-
The present distribution has been checked with version 8.14.1 of the Coq proof assistant, with a few plug-ins. \emph{Please refer to \href{https://github.com/coq-community/hydra-battle\#readme}{the README file of the project}.}
497
+
The present distribution has been checked with versions up to 8.18 of the Coq proof assistant, with a few plug-ins. \emph{Please refer to \href{https://github.com/coq-community/hydra-battle\#readme}{the README file of the project}.}
0 commit comments