| 1 |
\documentclass[a4paper]{article} |
| 2 |
\usepackage{fullpage} |
| 3 |
\usepackage[utf8]{inputenc} |
| 4 |
\usepackage[T1]{fontenc} |
| 5 |
\usepackage{amsfonts} |
| 6 |
|
| 7 |
\parindent=0pt |
| 8 |
\parskip=10pt |
| 9 |
|
| 10 |
%%%%%%%%%%%%% |
| 11 |
% Macros |
| 12 |
\newcommand\itemrule[3]{ |
| 13 |
\subsubsection{#1} |
| 14 |
\begin{quote} |
| 15 |
\begin{tt} |
| 16 |
#3 |
| 17 |
\end{tt} |
| 18 |
\end{quote} |
| 19 |
\begin{quote} |
| 20 |
Name: \texttt{#2} |
| 21 |
\end{quote}} |
| 22 |
|
| 23 |
\newcommand\formula[1]{\begin{tt}#1\end{tt}} |
| 24 |
\newcommand\tactic[1]{\begin{tt}#1\end{tt}} |
| 25 |
\newcommand\command[1]{\begin{tt}#1\end{tt}} |
| 26 |
\newcommand\term[1]{\begin{tt}#1\end{tt}} |
| 27 |
\newcommand\library[1]{\texttt{#1}} |
| 28 |
\newcommand\name[1]{\texttt{#1}} |
| 29 |
|
| 30 |
\newcommand\zero{\texttt{zero}} |
| 31 |
\newcommand\op{\texttt{op}} |
| 32 |
\newcommand\opPrime{\texttt{op'}} |
| 33 |
\newcommand\opSecond{\texttt{op''}} |
| 34 |
\newcommand\phimapping{\texttt{phi}} |
| 35 |
\newcommand\D{\texttt{D}} |
| 36 |
\newcommand\elt{\texttt{elt}} |
| 37 |
\newcommand\rel{\texttt{rel}} |
| 38 |
\newcommand\relp{\texttt{rel'}} |
| 39 |
|
| 40 |
%%%%%%%%%%%%% |
| 41 |
|
| 42 |
\begin{document} |
| 43 |
|
| 44 |
\begin{center} |
| 45 |
\begin{huge} |
| 46 |
Proposed naming conventions for the Coq standard library |
| 47 |
\end{huge} |
| 48 |
\end{center} |
| 49 |
\bigskip |
| 50 |
|
| 51 |
The following document describes a proposition of canonical naming |
| 52 |
schemes for the Coq standard library. Obviously and unfortunately, the |
| 53 |
current state of the library is not as homogeneous as it would be if |
| 54 |
it would systematically follow such a scheme. To tend in this |
| 55 |
direction, we however recommend to follow the following suggestions. |
| 56 |
|
| 57 |
\tableofcontents |
| 58 |
|
| 59 |
\section{General conventions} |
| 60 |
|
| 61 |
\subsection{Variable names} |
| 62 |
|
| 63 |
\begin{itemize} |
| 64 |
|
| 65 |
\item Variables are preferably quantified at the head of the |
| 66 |
statement, even if some premisses do not depend of one of them. For |
| 67 |
instance, one would state |
| 68 |
\begin{quote} |
| 69 |
\begin{tt} |
| 70 |
{forall x y z:D, x <= y -> x+z <= y+z} |
| 71 |
\end{tt} |
| 72 |
\end{quote} |
| 73 |
and not |
| 74 |
\begin{quote} |
| 75 |
\begin{tt} |
| 76 |
{forall x y:D, x <= y -> forall z:D, x+z <= y+z} |
| 77 |
\end{tt} |
| 78 |
\end{quote} |
| 79 |
|
| 80 |
\item Variables are preferably quantified (and named) in the order of |
| 81 |
``importance'', then of appearance, from left to right, even if |
| 82 |
for the purpose of some tactics it would have been more convenient |
| 83 |
to have, say, the variables not occurring in the conclusion |
| 84 |
first. For instance, one would state |
| 85 |
\begin{quote} |
| 86 |
\begin{tt} |
| 87 |
{forall x y z:D, x+z <= y+z -> x <= y} |
| 88 |
\end{tt} |
| 89 |
\end{quote} |
| 90 |
and not |
| 91 |
\begin{quote} |
| 92 |
\begin{tt} |
| 93 |
{forall z x y:D, x+z <= y+z -> x <= y} |
| 94 |
\end{tt} |
| 95 |
\end{quote} |
| 96 |
nor |
| 97 |
\begin{quote} |
| 98 |
\begin{tt} |
| 99 |
{forall x y z:D, y+x <= z+x -> y <= z} |
| 100 |
\end{tt} |
| 101 |
\end{quote} |
| 102 |
|
| 103 |
\item Choice of effective names is domain-dependent. For instance, on |
| 104 |
natural numbers, the convention is to use the variables $n$, $m$, |
| 105 |
$p$, $q$, $r$, $s$ in this order. |
| 106 |
|
| 107 |
On generic domains, the convention is to use the letters $x$, $y$, |
| 108 |
$z$, $t$. When more than three variables are needed, indexing variables |
| 109 |
|
| 110 |
It is conventional to use specific names for variables having a |
| 111 |
special meaning. For instance, $eps$ or $\epsilon$ can be used to |
| 112 |
denote a number intended to be as small as possible. Also, $q$ and |
| 113 |
$r$ can be used to denote a quotient and a rest. This is good |
| 114 |
practice. |
| 115 |
|
| 116 |
\end{itemize} |
| 117 |
|
| 118 |
\subsection{Disjunctive statements} |
| 119 |
|
| 120 |
A disjunctive statement with a computational content will be suffixed |
| 121 |
by \name{\_inf}. For instance, if |
| 122 |
|
| 123 |
\begin{quote} |
| 124 |
\begin{tt} |
| 125 |
{forall x y, op x y = zero -> x = zero \/ y = zero} |
| 126 |
\end{tt} |
| 127 |
\end{quote} |
| 128 |
has name \texttt{D\_integral}, then |
| 129 |
\begin{quote} |
| 130 |
\begin{tt} |
| 131 |
{forall x y, op x y = zero -> \{x = zero\} + \{y = zero\}} |
| 132 |
\end{tt} |
| 133 |
\end{quote} |
| 134 |
will have name \texttt{D\_integral\_inf}. |
| 135 |
|
| 136 |
As an exception, decidability statements, such as |
| 137 |
\begin{quote} |
| 138 |
\begin{tt} |
| 139 |
{forall x y, \{x = y\} + \{x <> y\}} |
| 140 |
\end{tt} |
| 141 |
\end{quote} |
| 142 |
will have a named ended in \texttt{\_dec}. Idem for cotransitivity |
| 143 |
lemmas which are inherently computational that are ended in |
| 144 |
\texttt{\_cotrans}. |
| 145 |
|
| 146 |
\subsection{Inductive types constructor names} |
| 147 |
|
| 148 |
As a general rule, constructor names start with the name of the |
| 149 |
inductive type being defined as in \texttt{Inductive Z := Z0 : Z | |
| 150 |
Zpos : Z -> Z | Zneg : Z -> Z} to the exception of very standard |
| 151 |
types like \texttt{bool}, \texttt{nat}, \texttt{list}... |
| 152 |
|
| 153 |
For inductive predicates, constructor names also start with the name |
| 154 |
of the notion being defined with one or more suffixes separated with |
| 155 |
\texttt{\_} for discriminating the different cases as e.g. in |
| 156 |
|
| 157 |
\begin{verbatim} |
| 158 |
Inductive even : nat -> Prop := |
| 159 |
| even_O : even 0 |
| 160 |
| even_S n : odd n -> even (S n) |
| 161 |
with odd : nat -> Prop := |
| 162 |
| odd_S n : even n -> odd (S n). |
| 163 |
\end{verbatim} |
| 164 |
|
| 165 |
As a general rule, inductive predicate names should be lowercase (to |
| 166 |
the exception of notions referring to a proper name, e.g. \texttt{Bezout}) |
| 167 |
and multiple words must be separated by ``{\_}''. |
| 168 |
|
| 169 |
As an exception, when extending libraries whose general rule is that |
| 170 |
predicates names start with a capital letter, the convention of this |
| 171 |
library should be kept and the separation between multiple words is |
| 172 |
done by making the initial of each work a capital letter (if one of |
| 173 |
these words is a proper name, then a ``{\_}'' is added to emphasize |
| 174 |
that the capital letter is proper and not an application of the rule |
| 175 |
for marking the change of word). |
| 176 |
|
| 177 |
Inductive predicates that characterize the specification of a function |
| 178 |
should be named after the function it specifies followed by |
| 179 |
\texttt{\_spec} as in: |
| 180 |
|
| 181 |
\begin{verbatim} |
| 182 |
Inductive nth_spec : list A -> nat -> A -> Prop := |
| 183 |
| nth_spec_O a l : nth_spec (a :: l) 0 a |
| 184 |
| nth_spec_S n a b l : nth_spec l n a -> nth_spec (b :: l) (S n) a. |
| 185 |
\end{verbatim} |
| 186 |
|
| 187 |
\section{Equational properties of operations} |
| 188 |
|
| 189 |
\subsection{General conventions} |
| 190 |
|
| 191 |
If the conclusion is in the other way than listed below, add suffix |
| 192 |
\name{\_reverse} to the lemma name. |
| 193 |
|
| 194 |
\subsection{Specific conventions} |
| 195 |
|
| 196 |
\itemrule{Associativity of binary operator {\op} on domain {\D}}{Dop\_assoc} |
| 197 |
{forall x y z:D, op x (op y z) = op (op x y) z} |
| 198 |
|
| 199 |
Remark: Symmetric form: \name{Dop\_assoc\_reverse}: |
| 200 |
\formula{forall x y z:D, op (op x y) z = op x (op y z)} |
| 201 |
|
| 202 |
\itemrule{Commutativity of binary operator {\op} on domain {\D}}{Dop\_comm} |
| 203 |
{forall x y:D, op x y = op y x} |
| 204 |
|
| 205 |
Remark: Avoid \formula{forall x y:D, op y x = op x y}, or at worst, call it |
| 206 |
\name{Dop\_comm\_reverse} |
| 207 |
|
| 208 |
\itemrule{Left neutrality of element elt for binary operator {\op}}{Dop\_elt\_l} |
| 209 |
{forall x:D, op elt x = x} |
| 210 |
|
| 211 |
Remark: In English, ``{\elt} is an identity for {\op}'' seems to be |
| 212 |
a more common terminology. |
| 213 |
|
| 214 |
\itemrule{Right neutrality of element elt for binary operator {\op}}{Dop\_elt\_r} |
| 215 |
{forall x:D, op x elt = x} |
| 216 |
|
| 217 |
Remark: By convention, if the identities are reminiscent to zero or one, they |
| 218 |
are written 1 and 0 in the name of the property. |
| 219 |
|
| 220 |
\itemrule{Left absorption of element elt for binary operator {\op}}{Dop\_elt\_l} |
| 221 |
{forall x:D, op elt x = elt} |
| 222 |
|
| 223 |
Remarks: |
| 224 |
\begin{itemize} |
| 225 |
\item In French school, this property is named "elt est absorbant pour op" |
| 226 |
\item English, the property seems generally named "elt is a zero of op" |
| 227 |
\item In the context of lattices, this a boundedness property, it may |
| 228 |
be called "elt is a bound on D", or referring to a (possibly |
| 229 |
arbitrarily oriented) order "elt is a least element of D" or "elt |
| 230 |
is a greatest element of D" |
| 231 |
\end{itemize} |
| 232 |
|
| 233 |
\itemrule{Right absorption of element {\elt} for binary operator {\op}}{Dop\_elt\_l [BAD ??]} |
| 234 |
{forall x:D, op x elt = elt} |
| 235 |
|
| 236 |
\itemrule{Left distributivity of binary operator {\op} over {\opPrime} on domain {\D}}{Dop\_op'\_distr\_l} |
| 237 |
{forall x y z:D, op (op' x y) z = op' (op x z) (op y z)} |
| 238 |
|
| 239 |
Remark: Some authors say ``distribution''. |
| 240 |
|
| 241 |
\itemrule{Right distributivity of binary operator {\op} over {\opPrime} on domain {\D}}{Dop\_op'\_distr\_r} |
| 242 |
{forall x y z:D, op z (op' x y) = op' (op z x) (op z y)} |
| 243 |
|
| 244 |
Remark: Note the order of arguments. |
| 245 |
|
| 246 |
\itemrule{Distributivity of unary operator {\op} over binary op' on domain {\D}}{Dop\_op'\_distr} |
| 247 |
{forall x y:D, op (op' x y) = op' (op x) (op y)} |
| 248 |
|
| 249 |
\itemrule{Distributivity of unary operator {\op} over binary op' on domain {\D}}{Dop\_op'\_distr} |
| 250 |
{forall x y:D, op (op' x y) = op' (op x) (op y)} |
| 251 |
|
| 252 |
Remark: For a non commutative operation with inversion of arguments, as in |
| 253 |
\formula{forall x y z:D, op (op' x y) = op' (op y) (op y z)}, |
| 254 |
we may probably still call the property distributivity since there |
| 255 |
is no ambiguity. |
| 256 |
|
| 257 |
Example: \formula{forall n m : Z, -(n+m) = (-n)+(-m)}. |
| 258 |
|
| 259 |
Example: \formula{forall l l' : list A, rev (l++l') = (rev l)++(rev l')}. |
| 260 |
|
| 261 |
\itemrule{Left extrusion of unary operator {\op} over binary op' on domain {\D}}{Dop\_op'\_distr\_l} |
| 262 |
{forall x y:D, op (op' x y) = op' (op x) y} |
| 263 |
|
| 264 |
Question: Call it left commutativity ?? left swap ? |
| 265 |
|
| 266 |
\itemrule{Right extrusion of unary operator {\op} over binary op' on domain {\D}}{Dop\_op'\_distr\_r} |
| 267 |
{forall x y:D, op (op' x y) = op' x (op y)} |
| 268 |
|
| 269 |
\itemrule{Idempotency of binary operator {\op} on domain {\D}}{Dop\_idempotent} |
| 270 |
{forall x:D, op x x = x} |
| 271 |
|
| 272 |
\itemrule{Idempotency of unary operator {\op} on domain {\D}}{Dop\_idempotent} |
| 273 |
{forall x:D, op (op x) = op x} |
| 274 |
|
| 275 |
Remark: This is actually idempotency of {\op} wrt to composition and |
| 276 |
identity. |
| 277 |
|
| 278 |
\itemrule{Idempotency of element elt for binary operator {\op} on domain {\D}}{Dop\_elt\_idempotent} |
| 279 |
{op elt elt = elt} |
| 280 |
|
| 281 |
Remark: Generally useless in CIC for concrete, computable operators |
| 282 |
|
| 283 |
Remark: The general definition is ``exists n, iter n op x = x''. |
| 284 |
|
| 285 |
\itemrule{Nilpotency of element elt wrt a ring D with additive neutral |
| 286 |
element {\zero} and multiplicative binary operator |
| 287 |
{\op}}{Delt\_nilpotent} |
| 288 |
{op elt elt = zero} |
| 289 |
|
| 290 |
Remark: We leave the ring structure of D implicit; the general definition is ``exists n, iter n op elt = zero''. |
| 291 |
|
| 292 |
\itemrule{Zero-product property in a ring D with additive neutral |
| 293 |
element {\zero} and multiplicative binary operator |
| 294 |
{\op}}{D\_integral} |
| 295 |
{forall x y, op x y = zero -> x = zero \/ y = zero} |
| 296 |
|
| 297 |
Remark: We leave the ring structure of D implicit; the Coq library |
| 298 |
uses either \texttt{\_is\_O} (for \texttt{nat}), \texttt{\_integral} |
| 299 |
(for \texttt{Z}, \texttt{Q} and \texttt{R}), \texttt{eq\_mul\_0} (for |
| 300 |
\texttt{NZ}). |
| 301 |
|
| 302 |
Remark: The French school says ``integrité''. |
| 303 |
|
| 304 |
\itemrule{Nilpotency of binary operator {\op} wrt to its absorbing element |
| 305 |
zero in D}{Dop\_nilpotent} {forall x, op x x = zero} |
| 306 |
|
| 307 |
Remark: Did not find this definition on the web, but it used in |
| 308 |
the Coq library (to characterize \name{xor}). |
| 309 |
|
| 310 |
\itemrule{Involutivity of unary op on D}{Dop\_involutive} |
| 311 |
{forall x:D, op (op x) = x} |
| 312 |
|
| 313 |
\itemrule{Absorption law on the left for binary operator {\op} over binary operator {\op}' on the left}{Dop\_op'\_absorption\_l\_l} |
| 314 |
{forall x y:D, op x (op' x y) = x} |
| 315 |
|
| 316 |
\itemrule{Absorption law on the left for binary operator {\op} over binary operator {\op}' on the right}{Dop\_op'\_absorption\_l\_r} |
| 317 |
{forall x y:D, op x (op' y x) = x} |
| 318 |
|
| 319 |
Remark: Similarly for \name{Dop\_op'\_absorption\_r\_l} and \name{Dop\_op'\_absorption\_r\_r}. |
| 320 |
|
| 321 |
\itemrule{De Morgan law's for binary operators {\opPrime} and {\opSecond} wrt |
| 322 |
to unary op on domain {\D}}{Dop'\_op''\_de\_morgan, |
| 323 |
Dop''\_op'\_de\_morgan ?? \mbox{leaving the complementing operation |
| 324 |
implicit})} |
| 325 |
{forall x y:D, op (op' x y) = op'' (op x) (op y)\\ |
| 326 |
forall x y:D, op (op'' x y) = op' (op x) (op y)} |
| 327 |
|
| 328 |
\itemrule{Left complementation of binary operator {\op} by means of unary {\opPrime} wrt neutral element {\elt} of {\op} on domain {\D}}{Dop\_op'\_opp\_l} |
| 329 |
{forall x:D, op (op' x) x = elt} |
| 330 |
|
| 331 |
Remark: If the name of the opposite function is reminiscent of the |
| 332 |
notion of complement (e.g. if it is called \texttt{opp}), one can |
| 333 |
simply say {Dop\_opp\_l}. |
| 334 |
|
| 335 |
\itemrule{Right complementation of binary operator {\op} by means of unary {\op'} wrt neutral element {\elt} of {\op} on domain {\D}}{Dop\_opp\_r} |
| 336 |
{forall x:D, op x (op' x) = elt} |
| 337 |
|
| 338 |
Example: \formula{Radd\_opp\_l: forall r : R, - r + r = 0} |
| 339 |
|
| 340 |
\itemrule{Associativity of binary operators {\op} and {\op'}}{Dop\_op'\_assoc} |
| 341 |
{forall x y z, op x (op' y z) = op (op' x y) z} |
| 342 |
|
| 343 |
Example: \formula{forall x y z, x + (y - z) = (x + y) - z} |
| 344 |
|
| 345 |
\itemrule{Right extrusion of binary operator {\opPrime} over binary operator {\op}}{Dop\_op'\_extrusion\_r} |
| 346 |
{forall x y z, op x (op' y z) = op' (op x y) z} |
| 347 |
|
| 348 |
Remark: This requires {\op} and {\opPrime} to have their right and left |
| 349 |
argument respectively and their return types identical. |
| 350 |
|
| 351 |
Example: \formula{forall x y z, x + (y - z) = (x + y) - z} |
| 352 |
|
| 353 |
Remark: Other less natural combinations are possible, such |
| 354 |
as \formula{forall x y z, op x (op' y z) = op' y (op x z)}. |
| 355 |
|
| 356 |
\itemrule{Left extrusion of binary operator {\opPrime} over binary operator {\op}}{Dop\_op'\_extrusion\_l} |
| 357 |
{forall x y z, op (op' x y) z = op' x (op y z)} |
| 358 |
|
| 359 |
Remark: Operations are not necessarily internal composition laws. It |
| 360 |
is only required that {\op} and {\opPrime} have their right and left |
| 361 |
argument respectively and their return type identical. |
| 362 |
|
| 363 |
Remark: When the type are heterogeneous, only one extrusion law is possible and it can simply be named {Dop\_op'\_extrusion}. |
| 364 |
|
| 365 |
Example: \formula{app\_cons\_extrusion : forall a l l', (a :: l) ++ l' = a :: (l ++ l')}. |
| 366 |
|
| 367 |
%====================================================================== |
| 368 |
%\section{Properties of elements} |
| 369 |
|
| 370 |
%Remark: Not used in current library |
| 371 |
|
| 372 |
|
| 373 |
|
| 374 |
%====================================================================== |
| 375 |
\section{Preservation and compatibility properties of operations} |
| 376 |
|
| 377 |
\subsection{With respect to equality} |
| 378 |
|
| 379 |
\itemrule{Injectivity of unary operator {\op}}{Dop\_inj} |
| 380 |
{forall x y:D, op x = op y -> x = y} |
| 381 |
|
| 382 |
\itemrule{Left regularity of binary operator {\op}}{Dop\_reg\_l, Dop\_inj\_l, or Dop\_cancel\_l} |
| 383 |
{forall x y z:D, op z x = op z y -> x = y} |
| 384 |
|
| 385 |
Remark: Note the order of arguments. |
| 386 |
|
| 387 |
Remark: The Coq usage is to called it regularity but the English |
| 388 |
standard seems to be cancellation. The recommended form is not |
| 389 |
decided yet. |
| 390 |
|
| 391 |
Remark: Shall a property like $n^p \leq n^q \rightarrow p \leq q$ |
| 392 |
(for $n\geq 1$) be called cancellation or should it be reserved for |
| 393 |
operators that have an inverse? |
| 394 |
|
| 395 |
\itemrule{Right regularity of binary operator {\op}}{Dop\_reg\_r, Dop\_inj\_r, Dop\_cancel\_r} |
| 396 |
{forall x y z:D, op x z = op y z -> x = y} |
| 397 |
|
| 398 |
\subsection{With respect to a relation {\rel}} |
| 399 |
|
| 400 |
\itemrule{Compatibility of unary operator {\op}}{Dop\_rel\_compat} |
| 401 |
{forall x y:D, rel x y -> rel (op x) (op y)} |
| 402 |
|
| 403 |
\itemrule{Left compatibility of binary operator {\op}}{Dop\_rel\_compat\_l} |
| 404 |
{forall x y z:D, rel x y -> rel (op z x) (op z y)} |
| 405 |
|
| 406 |
\itemrule{Right compatibility of binary operator {\op}}{Dop\_rel\_compat\_r} |
| 407 |
{forall x y z:D, rel x y -> rel (op x z) (op y z)} |
| 408 |
|
| 409 |
Remark: For equality, use names of the form \name{Dop\_eq\_compat\_l} or |
| 410 |
\name{Dop\_eq\_compat\_r} |
| 411 |
(\formula{forall x y z:D, y = x -> op y z = op x z} and |
| 412 |
\formula{forall x y z:D, y = x -> op y z = op x z}) |
| 413 |
|
| 414 |
Remark: Should we admit (or even prefer) the name |
| 415 |
\name{Dop\_rel\_monotone}, \name{Dop\_rel\_monotone\_l}, |
| 416 |
\name{Dop\_rel\_monotone\_r} when {\rel} is an order ? |
| 417 |
|
| 418 |
\itemrule{Left regularity of binary operator {\op}}{Dop\_rel\_reg\_l} |
| 419 |
{forall x y z:D, rel (op z x) (op z y) -> rel x y} |
| 420 |
|
| 421 |
\itemrule{Right regularity of binary operator {\op}}{Dop\_rel\_reg\_r} |
| 422 |
{forall x y z:D, rel (op x z) (op y z) -> rel x y} |
| 423 |
|
| 424 |
Question: Would it be better to have \name{z} as first argument, since it |
| 425 |
is missing in the conclusion ?? (or admit we shall use the options |
| 426 |
``\texttt{with p}''?) |
| 427 |
|
| 428 |
\itemrule{Left distributivity of binary operator {\op} over {\opPrime} along relation {\rel} on domain {\D}}{Dop\_op'\_rel\_distr\_l} |
| 429 |
{forall x y z:D, rel (op (op' x y) z) (op' (op x z) (op y z))} |
| 430 |
|
| 431 |
Example: standard property of (not necessarily distributive) lattices |
| 432 |
|
| 433 |
Remark: In a (non distributive) lattice, by swapping join and meet, |
| 434 |
one would like also, |
| 435 |
\formula{forall x y z:D, rel (op' (op x z) (op y z)) (op (op' x y) z)}. |
| 436 |
How to name it with a symmetric name (use |
| 437 |
\name{Dop\_op'\_rel\_distr\_mon\_l} and |
| 438 |
\name{Dop\_op'\_rel\_distr\_anti\_l})? |
| 439 |
|
| 440 |
\itemrule{Commutativity of binary operator {\op} along (equivalence) relation {\rel} on domain {\D}}{Dop\_op'\_rel\_comm} |
| 441 |
{forall x y z:D, rel (op x y) (op y x)} |
| 442 |
|
| 443 |
Example: |
| 444 |
\formula{forall l l':list A, Permutation (l++l') (l'++l)} |
| 445 |
|
| 446 |
\itemrule{Irreducibility of binary operator {\op} on domain {\D}}{Dop\_irreducible} |
| 447 |
{forall x y z:D, z = op x y -> z = x $\backslash/$ z = y} |
| 448 |
|
| 449 |
Question: What about the constructive version ? Call it \name{Dop\_irreducible\_inf} ? |
| 450 |
\formula{forall x y z:D, z = op x y -> \{z = x\} + \{z = y\}} |
| 451 |
|
| 452 |
\itemrule{Primality of binary operator {\op} along relation {\rel} on domain {\D}}{Dop\_rel\_prime} |
| 453 |
{forall x y z:D, rel z (op x y) -> rel z x $\backslash/$ rel z y} |
| 454 |
|
| 455 |
|
| 456 |
%====================================================================== |
| 457 |
\section{Morphisms} |
| 458 |
|
| 459 |
\itemrule{Morphism between structures {\D} and {\D'}}{\name{D'\_of\_D}}{D -> D'} |
| 460 |
|
| 461 |
Remark: If the domains are one-letter long, one can used \texttt{IDD'} as for |
| 462 |
\name{INR} or \name{INZ}. |
| 463 |
|
| 464 |
\itemrule{Morphism {\phimapping} mapping unary operators {\op} to {\op'}}{phi\_op\_op', phi\_op\_op'\_morphism} |
| 465 |
{forall x:D, phi (op x) = op' (phi x)} |
| 466 |
|
| 467 |
Remark: If the operators have the same name in both domains, one use |
| 468 |
\texttt{D'\_of\_D\_op} or \texttt{IDD'\_op}. |
| 469 |
|
| 470 |
Example: \formula{Z\_of\_nat\_mult: forall n m : nat, Z\_of\_nat (n * m) = (Z\_of\_nat n * Z\_of\_nat m)\%Z}. |
| 471 |
|
| 472 |
Remark: If the operators have different names on distinct domains, one |
| 473 |
can use \texttt{op\_op'}. |
| 474 |
|
| 475 |
\itemrule{Morphism {\phimapping} mapping binary operators {\op} to |
| 476 |
{\op'}}{phi\_op\_op', phi\_op\_op'\_morphism} {forall |
| 477 |
x y:D, phi (op x y) = op' (phi x) (phi y)} |
| 478 |
|
| 479 |
Remark: If the operators have the same name in both domains, one use |
| 480 |
\texttt{D'\_of\_D\_op} or \texttt{IDD'\_op}. |
| 481 |
|
| 482 |
Remark: If the operators have different names on distinct domains, one |
| 483 |
can use \texttt{op\_op'}. |
| 484 |
|
| 485 |
\itemrule{Morphism {\phimapping} mapping binary operator {\op} to |
| 486 |
binary relation {\rel}}{phi\_op\_rel, phi\_op\_rel\_morphism} |
| 487 |
{forall x y:D, phi (op x y) <-> rel (phi x) (phi y)} |
| 488 |
|
| 489 |
Remark: If the operator and the relation have similar name, one uses |
| 490 |
\texttt{phi\_op}. |
| 491 |
|
| 492 |
Question: How to name each direction? (add \_elim for -> and \_intro |
| 493 |
for <- ?? -- as done in Bool.v ??) |
| 494 |
|
| 495 |
Example: \formula{eq\_true\_neg: \~{} eq\_true b <-> eq\_true (negb b)}. |
| 496 |
|
| 497 |
%====================================================================== |
| 498 |
\section{Preservation and compatibility properties of operations wrt order} |
| 499 |
|
| 500 |
\itemrule{Compatibility of binary operator {\op} wrt (strict order) {\rel} and (large order) {\rel'}}{Dop\_rel\_rel'\_compat} |
| 501 |
{forall x y z t:D, rel x y -> rel' z t -> rel (op x z) (op y t)} |
| 502 |
|
| 503 |
\itemrule{Compatibility of binary operator {\op} wrt (large order) {\relp} and (strict order) {\rel}}{Dop\_rel'\_rel\_compat} |
| 504 |
{forall x y z t:D, rel' x y -> rel z t -> rel (op x z) (op y t)} |
| 505 |
|
| 506 |
|
| 507 |
%====================================================================== |
| 508 |
\section{Properties of relations} |
| 509 |
|
| 510 |
\itemrule{Reflexivity of relation {\rel} on domain {\D}}{Drel\_refl} |
| 511 |
{forall x:D, rel x x} |
| 512 |
|
| 513 |
\itemrule{Symmetry of relation {\rel} on domain {\D}}{Drel\_sym} |
| 514 |
{forall x y:D, rel x y -> rel y x} |
| 515 |
|
| 516 |
\itemrule{Transitivity of relation {\rel} on domain {\D}}{Drel\_trans} |
| 517 |
{forall x y z:D, rel x y -> rel y z -> rel x z} |
| 518 |
|
| 519 |
\itemrule{Antisymmetry of relation {\rel} on domain {\D}}{Drel\_antisym} |
| 520 |
{forall x y:D, rel x y -> rel y x -> x = y} |
| 521 |
|
| 522 |
\itemrule{Irreflexivity of relation {\rel} on domain {\D}}{Drel\_irrefl} |
| 523 |
{forall x:D, \~{} rel x x} |
| 524 |
|
| 525 |
\itemrule{Asymmetry of relation {\rel} on domain {\D}}{Drel\_asym} |
| 526 |
{forall x y:D, rel x y -> \~{} rel y x} |
| 527 |
|
| 528 |
\itemrule{Cotransitivity of relation {\rel} on domain {\D}}{Drel\_cotrans} |
| 529 |
{forall x y z:D, rel x y -> \{rel z y\} + \{rel x z\}} |
| 530 |
|
| 531 |
\itemrule{Linearity of relation {\rel} on domain {\D}}{Drel\_trichotomy} |
| 532 |
{forall x y:D, \{rel x y\} + \{x = y\} + \{rel y x\}} |
| 533 |
|
| 534 |
Questions: Or call it \name{Drel\_total}, or \name{Drel\_linear}, or |
| 535 |
\name{Drel\_connected}? Use |
| 536 |
$\backslash/$ ? or use a ternary sumbool, or a ternary disjunction, |
| 537 |
for nicer elimination. |
| 538 |
|
| 539 |
\itemrule{Informative decidability of relation {\rel} on domain {\D}}{Drel\_dec (or Drel\_dect, Drel\_dec\_inf ?)} |
| 540 |
{forall x y:D, \{rel x y\} + \{\~{} rel x y\}} |
| 541 |
|
| 542 |
Remark: If equality: \name{D\_eq\_dec} or \name{D\_dec} (not like |
| 543 |
\name{eq\_nat\_dec}) |
| 544 |
|
| 545 |
\itemrule{Non informative decidability of relation {\rel} on domain {\D}}{Drel\_dec\_prop (or Drel\_dec)} |
| 546 |
{forall x y:D, rel x y $\backslash/$ \~{} rel x y} |
| 547 |
|
| 548 |
\itemrule{Inclusion of relation {\rel} in relation {\rel}' on domain {\D}}{Drel\_rel'\_incl (or Drel\_incl\_rel')} |
| 549 |
{forall x y:D, rel x y -> rel' x y} |
| 550 |
|
| 551 |
Remark: Use \name{Drel\_rel'\_weak} for a strict inclusion ?? |
| 552 |
|
| 553 |
%====================================================================== |
| 554 |
\section{Relations between properties} |
| 555 |
|
| 556 |
\itemrule{Equivalence of properties \texttt{P} and \texttt{Q}}{P\_Q\_iff} |
| 557 |
{forall x1 .. xn, P <-> Q} |
| 558 |
|
| 559 |
Remark: Alternatively use \name{P\_iff\_Q} if it is too difficult to |
| 560 |
recover what pertains to \texttt{P} and what pertains to \texttt{Q} |
| 561 |
in their concatenation (as e.g. in |
| 562 |
\texttt{Godel\_Dummett\_iff\_right\_distr\_implication\_over\_disjunction}). |
| 563 |
|
| 564 |
%====================================================================== |
| 565 |
\section{Arithmetical conventions} |
| 566 |
|
| 567 |
\begin{minipage}{6in} |
| 568 |
\renewcommand{\thefootnote}{\thempfootnote} % For footnotes... |
| 569 |
\begin{tabular}{lll} |
| 570 |
Zero on domain {\D} & D0 & (notation \verb=0=)\\ |
| 571 |
One on domain {\D} & D1 (if explicitly defined) & (notation \verb=1=)\\ |
| 572 |
Successor on domain {\D} & Dsucc\\ |
| 573 |
Predecessor on domain {\D} & Dpred\\ |
| 574 |
Addition on domain {\D} & Dadd/Dplus\footnote{Coq historically uses \texttt{plus} and \texttt{mult} for addition and multiplication which are inconsistent notations, the recommendation is to use \texttt{add} and \texttt{mul} except in existing libraries that already use \texttt{plus} and \texttt{mult}} |
| 575 |
& (infix notation \verb=+= [50,L])\\ |
| 576 |
Multiplication on domain {\D} & Dmul/Dmult\footnotemark[\value{footnote}] & (infix notation \verb=*= [40,L]))\\ |
| 577 |
Subtraction on domain {\D} & Dminus & (infix notation \verb=-= [50,L])\\ |
| 578 |
Opposite on domain {\D} & Dopp (if any) & (prefix notation \verb=-= [35,R]))\\ |
| 579 |
Inverse on domain {\D} & Dinv (if any) & (prefix notation \verb=/= [35,R]))\\ |
| 580 |
Power on domain {\D} & Dpower & (infix notation \verb=^= [30,R])\\ |
| 581 |
Minimal element on domain {\D} & Dmin\\ |
| 582 |
Maximal element on domain {\D} & Dmax\\ |
| 583 |
Large less than order on {\D} & Dle & (infix notations \verb!<=! and \verb!>=! [70,N]))\\ |
| 584 |
Strict less than order on {\D} & Dlt & (infix notations \verb=<= and \verb=>= [70,N]))\\ |
| 585 |
\end{tabular} |
| 586 |
\bigskip |
| 587 |
\end{minipage} |
| 588 |
|
| 589 |
\bigskip |
| 590 |
|
| 591 |
The status of \verb!>=! and \verb!>! is undecided yet. It will eithet |
| 592 |
be accepted only as parsing notations or may also accepted as a {\em |
| 593 |
definition} for the \verb!<=! and \verb!<! (like in \texttt{nat}) or |
| 594 |
even as a different definition (like it is the case in \texttt{Z}). |
| 595 |
|
| 596 |
\bigskip |
| 597 |
|
| 598 |
Exception: Peano Arithmetic which is used for pedagogical purpose: |
| 599 |
|
| 600 |
\begin{itemize} |
| 601 |
\item domain name is implicit |
| 602 |
\item \term{0} (digit $0$) is \term{O} (the 15th letter of the alphabet) |
| 603 |
\item \term{succ} is \verb!S! (but \term{succ} can be used in theorems) |
| 604 |
\end{itemize} |
| 605 |
|
| 606 |
\end{document} |