1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2018 Julien Lepiller <julien@lepiller.eu>
4 ;;; This file is part of GNU Guix.
6 ;;; GNU Guix is free software; you can redistribute it and/or modify it
7 ;;; under the terms of the GNU General Public License as published by
8 ;;; the Free Software Foundation; either version 3 of the License, or (at
9 ;;; your option) any later version.
11 ;;; GNU Guix is distributed in the hope that it will be useful, but
12 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;;; GNU General Public License for more details.
16 ;;; You should have received a copy of the GNU General Public License
17 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19 (define-module (gnu packages coq)
20 #:use-module (gnu packages)
21 #:use-module (gnu packages base)
22 #:use-module (gnu packages bison)
23 #:use-module (gnu packages boost)
24 #:use-module (gnu packages emacs)
25 #:use-module (gnu packages flex)
26 #:use-module (gnu packages multiprecision)
27 #:use-module (gnu packages ocaml)
28 #:use-module (gnu packages perl)
29 #:use-module (gnu packages python)
30 #:use-module (gnu packages texinfo)
31 #:use-module (guix build-system gnu)
32 #:use-module (guix build-system ocaml)
33 #:use-module (guix download)
34 #:use-module ((guix licenses) #:prefix license:)
35 #:use-module (guix packages)
36 #:use-module (guix utils)
37 #:use-module ((srfi srfi-1) #:hide (zip)))
45 (uri (string-append "https://github.com/coq/coq/archive/V"
47 (file-name (string-append name "-" version ".tar.gz"))
50 "0i2hs0i6rp27cy8zd0mx7jscqw5cx2y0diw0pxgij66s3yr47y7r"))))
52 (list (search-path-specification
54 (files (list "lib/coq/user-contrib")))))
55 (build-system ocaml-build-system)
57 `(("lablgtk" ,lablgtk)
60 ("ocaml-num" ,ocaml-num)))
63 (modify-phases %standard-phases
65 (lambda* (#:key outputs #:allow-other-keys)
66 (let* ((out (assoc-ref outputs "out"))
67 (mandir (string-append out "/share/man"))
68 (browser "icecat -remote \"OpenURL(%s,new-tab)\""))
77 "-j" (number->string (parallel-job-count))
80 (add-after 'install 'check
82 (with-directory-excursion "test-suite"
83 ;; These two tests fail.
84 ;; This one fails because the output is not formatted as expected.
85 (delete-file-recursively "coq-makefile/timing")
86 ;; This one fails because we didn't build coqtop.byte.
87 (delete-file-recursively "coq-makefile/findlib-package")
89 (home-page "https://coq.inria.fr")
90 (synopsis "Proof assistant for higher-order logic")
92 "Coq is a proof assistant for higher-order logic, which allows the
93 development of computer programs consistent with their formal specification.
94 It is developed using Objective Caml and Camlp5.")
95 ;; The code is distributed under lgpl2.1.
96 ;; Some of the documentation is distributed under opl1.0+.
97 (license (list license:lgpl2.1 license:opl1.0+))))
99 (define-public proof-general
101 (name "proof-general")
106 "http://proofgeneral.inf.ed.ac.uk/releases/"
107 "ProofGeneral-" version ".tgz"))
110 "09qb0myq66fw17v4ziz401ilsb5xlxz1nl2wsp69d0vrfy0bcrrm"))))
111 (build-system gnu-build-system)
114 ("emacs" ,emacs-minimal)
115 ("texinfo" ,texinfo)))
117 `(("host-emacs" ,emacs)
121 `(#:tests? #f ; no check target
122 #:make-flags (list (string-append "PREFIX=" %output)
123 (string-append "DEST_PREFIX=" %output))
124 #:modules ((guix build gnu-build-system)
126 (guix build emacs-utils))
127 #:imported-modules (,@%gnu-build-system-modules
128 (guix build emacs-utils))
130 (modify-phases %standard-phases
132 (add-after 'unpack 'disable-byte-compile-error-on-warn
134 (substitute* "Makefile"
135 (("\\(setq byte-compile-error-on-warn t\\)")
136 "(setq byte-compile-error-on-warn nil)"))
138 (add-after 'unpack 'patch-hardcoded-paths
139 (lambda* (#:key inputs outputs #:allow-other-keys)
140 (let ((out (assoc-ref outputs "out"))
141 (coq (assoc-ref inputs "coq"))
142 (emacs (assoc-ref inputs "host-emacs")))
143 (define (coq-prog name)
144 (string-append coq "/bin/" name))
145 (emacs-substitute-variables "coq/coq.el"
146 ("coq-prog-name" (coq-prog "coqtop"))
147 ("coq-compiler" (coq-prog "coqc"))
148 ("coq-dependency-analyzer" (coq-prog "coqdep")))
149 (substitute* "Makefile"
150 (("/sbin/install-info") "install-info"))
151 (substitute* "bin/proofgeneral"
152 (("^PGHOMEDEFAULT=.*" all)
154 "PGHOME=$PGHOMEDEFAULT\n"
155 "EMACS=" emacs "/bin/emacs")))
157 (add-after 'unpack 'clean
159 ;; Delete the pre-compiled elc files for Emacs 23.
160 (invoke "make" "clean")))
161 (add-after 'install 'install-doc
162 (lambda* (#:key make-flags #:allow-other-keys)
163 ;; XXX FIXME avoid building/installing pdf files,
164 ;; due to unresolved errors building them.
165 (substitute* "Makefile"
166 ((" [^ ]*\\.pdf") ""))
167 (apply invoke "make" "install-doc" make-flags))))))
168 (home-page "http://proofgeneral.inf.ed.ac.uk/")
169 (synopsis "Generic front-end for proof assistants based on Emacs")
171 "Proof General is a major mode to turn Emacs into an interactive proof
172 assistant to write formal mathematical proofs using a variety of theorem
174 (license license:gpl2+)))
176 (define-public coq-flocq
182 ;; Use the ‘Latest version’ link for a stable URI across releases.
183 (uri (string-append "https://gforge.inria.fr/frs/download.php/"
184 "file/37454/flocq-" version ".tar.gz"))
187 "06msp1fwpqv6p98a3i1nnkj7ch9rcq3rm916yxq8dxf51lkghrin"))))
188 (build-system gnu-build-system)
195 (list (string-append "--libdir=" (assoc-ref %outputs "out")
196 "/lib/coq/user-contrib/Flocq"))
198 (modify-phases %standard-phases
199 (add-before 'configure 'fix-remake
201 (substitute* "remake.cpp"
202 (("/bin/sh") (which "sh")))
210 (invoke "./remake" "check")
212 ;; TODO: requires coq-gappa and coq-interval.
213 ;(invoke "./remake" "check-more")
216 (invoke "./remake" "install")
218 (home-page "http://flocq.gforge.inria.fr/")
219 (synopsis "Floating-point formalization for the Coq system")
220 (description "Flocq (Floats for Coq) is a floating-point formalization for
221 the Coq system. It provides a comprehensive library of theorems on a multi-radix
222 multi-precision arithmetic. It also supports efficient numerical computations
224 (license license:lgpl3+)))
226 (define-public coq-gappa
232 (uri (string-append "https://gforge.inria.fr/frs/download.php/file/36397/gappa-"
236 "19kg2zldaqs4smy7bv9hp650sqg46xbx1ss7jnyagpxdscwn9apd"))))
237 (build-system gnu-build-system)
250 (list (string-append "--libdir=" (assoc-ref %outputs "out")
251 "/lib/coq/user-contrib/Gappa"))
253 (modify-phases %standard-phases
254 (add-before 'configure 'fix-remake
256 (substitute* "remake.cpp"
257 (("/bin/sh") (which "sh")))
260 (lambda _ (invoke "./remake")))
262 (lambda _ (invoke "./remake" "check")))
264 (lambda _ (invoke "./remake" "install"))))))
265 (home-page "http://gappa.gforge.inria.fr/")
266 (synopsis "Verify and formally prove properties on numerical programs")
267 (description "Gappa is a tool intended to help verifying and formally proving
268 properties on numerical programs dealing with floating-point or fixed-point
269 arithmetic. It has been used to write robust floating-point filters for CGAL
270 and it is used to certify elementary functions in CRlibm. While Gappa is
271 intended to be used directly, it can also act as a backend prover for the Why3
272 software verification plateform or as an automatic tactic for the Coq proof
274 (license (list license:gpl2+ license:cecill))));either gpl2+ or cecill
276 (define-public coq-mathcomp
278 (name "coq-mathcomp")
282 (uri (string-append "https://github.com/math-comp/math-comp/archive/mathcomp-"
286 "05zgyi4wmasi1rcyn5jq42w0bi9713q9m8dl1fdgl66nmacixh39"))))
287 (build-system gnu-build-system)
293 `(#:tests? #f; No need to test formally-verified programs :)
295 (modify-phases %standard-phases
297 (add-before 'build 'chdir
298 (lambda _ (chdir "mathcomp") #t))
300 (lambda* (#:key outputs #:allow-other-keys)
301 (setenv "COQLIB" (string-append (assoc-ref outputs "out") "/lib/coq/"))
302 (invoke "make" "-f" "Makefile.coq"
303 (string-append "COQLIB=" (assoc-ref outputs "out")
306 (home-page "https://math-comp.github.io/math-comp/")
307 (synopsis "Mathematical Components for Coq")
308 (description "Mathematical Components for Coq has its origins in the formal
309 proof of the Four Colour Theorem. Since then it has grown to cover many areas
310 of mathematics and has been used for large scale projects like the formal proof
311 of the Odd Order Theorem.
313 The library is written using the Ssreflect proof language that is an integral
314 part of the distribution.")
315 (license license:cecill-b)))
317 (define-public coq-coquelicot
319 (name "coq-coquelicot")
323 (uri (string-append "https://gforge.inria.fr/frs/download.php/"
324 "file/37045/coquelicot-" version ".tar.gz"))
327 "0hsyhsy2lwqxxx2r8xgi5csmirss42lp9bkb9yy35mnya0w78c8r"))))
328 (build-system gnu-build-system)
334 `(("mathcomp" ,coq-mathcomp)))
337 (list (string-append "--libdir=" (assoc-ref %outputs "out")
338 "/lib/coq/user-contrib/Coquelicot"))
340 (modify-phases %standard-phases
341 (add-before 'configure 'fix-coq8.8
343 ; appcontext has been removed from coq 8.8
344 (substitute* "theories/AutoDerive.v"
345 (("appcontext") "context"))
347 (add-before 'configure 'fix-remake
349 (substitute* "remake.cpp"
350 (("/bin/sh") (which "sh")))
353 (lambda _ (invoke "./remake")))
355 (lambda _ (invoke "./remake" "check")))
357 (lambda _ (invoke "./remake" "install"))))))
358 (home-page "http://coquelicot.saclay.inria.fr/index.html")
359 (synopsis "Coq library for Reals")
360 (description "Coquelicot is an easier way of writing formulas and theorem
361 statements, achieved by relying on total functions in place of dependent types
362 for limits, derivatives, integrals, power series, and so on. To help with the
363 proof process, the library comes with a comprehensive set of theorems that cover
364 not only these notions, but also some extensions such as parametric integrals,
365 two-dimensional differentiability, asymptotic behaviors. It also offers some
366 automations for performing differentiability proofs. Moreover, Coquelicot is a
367 conservative extension of Coq's standard library and provides correspondence
368 theorems between the two libraries.")
369 (license license:lgpl3+)))
371 (define-public coq-bignums
377 (uri (string-append "https://github.com/coq/bignums/archive/V"
379 (file-name (string-append name "-" version ".tar.gz"))
382 "08m1cmq4hkaf4sb0vy978c11rgzvds71cphyadmr2iirpr5815r0"))))
383 (build-system gnu-build-system)
388 `(("camlp5" ,camlp5)))
390 `(#:tests? #f; No test target
392 (list (string-append "COQLIBINSTALL=" (assoc-ref %outputs "out")
393 "/lib/coq/user-contrib"))
395 (modify-phases %standard-phases
396 (delete 'configure))))
397 (home-page "https://github.com/coq/bignums")
398 (synopsis "Coq library for arbitrary large numbers")
399 (description "Bignums is a coq library of arbitrary large numbers. It
400 provides BigN, BigZ, BigQ that used to be part of Coq standard library.")
401 (license license:lgpl2.1+)))
403 (define-public coq-interval
405 (name "coq-interval")
409 (uri (string-append "https://gforge.inria.fr/frs/download.php/"
410 "file/37077/interval-" version ".tar.gz"))
413 "08fdcf3hbwqphglvwprvqzgkg0qbimpyhnqsgv3gac4y1ap0f903"))))
414 (build-system gnu-build-system)
420 `(("flocq" ,coq-flocq)
421 ("bignums" ,coq-bignums)
422 ("coquelicot" ,coq-coquelicot)
423 ("mathcomp" ,coq-mathcomp)))
426 (list (string-append "--libdir=" (assoc-ref %outputs "out")
427 "/lib/coq/user-contrib/Gappa"))
429 (modify-phases %standard-phases
430 (add-before 'configure 'fix-remake
432 (substitute* "remake.cpp"
433 (("/bin/sh") (which "sh")))
436 (lambda _ (invoke "./remake")))
438 (lambda _ (invoke "./remake" "check")))
440 (lambda _ (invoke "./remake" "install"))))))
441 (home-page "http://coq-interval.gforge.inria.fr/")
442 (synopsis "Coq tactics to simplify inequality proofs")
443 (description "Interval provides vernacular files containing tactics for
444 simplifying the proofs of inequalities on expressions of real numbers for the
445 Coq proof assistant.")
446 (license license:cecill-c)))