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 (zero? (system* "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 (zero? (apply system* "make" "install-doc"
169 (home-page "http://proofgeneral.inf.ed.ac.uk/")
170 (synopsis "Generic front-end for proof assistants based on Emacs")
172 "Proof General is a major mode to turn Emacs into an interactive proof
173 assistant to write formal mathematical proofs using a variety of theorem
175 (license license:gpl2+)))
177 (define-public coq-flocq
183 ;; Use the ‘Latest version’ link for a stable URI across releases.
184 (uri (string-append "https://gforge.inria.fr/frs/download.php/"
185 "file/37454/flocq-" version ".tar.gz"))
188 "06msp1fwpqv6p98a3i1nnkj7ch9rcq3rm916yxq8dxf51lkghrin"))))
189 (build-system gnu-build-system)
196 (list (string-append "--libdir=" (assoc-ref %outputs "out")
197 "/lib/coq/user-contrib/Flocq"))
199 (modify-phases %standard-phases
200 (add-before 'configure 'fix-remake
202 (substitute* "remake.cpp"
203 (("/bin/sh") (which "sh")))
211 (invoke "./remake" "check")
213 ;; TODO: requires coq-gappa and coq-interval.
214 ;(invoke "./remake" "check-more")
217 (invoke "./remake" "install")
219 (home-page "http://flocq.gforge.inria.fr/")
220 (synopsis "Floating-point formalization for the Coq system")
221 (description "Flocq (Floats for Coq) is a floating-point formalization for
222 the Coq system. It provides a comprehensive library of theorems on a multi-radix
223 multi-precision arithmetic. It also supports efficient numerical computations
225 (license license:lgpl3+)))
227 (define-public coq-gappa
233 (uri (string-append "https://gforge.inria.fr/frs/download.php/file/36397/gappa-"
237 "19kg2zldaqs4smy7bv9hp650sqg46xbx1ss7jnyagpxdscwn9apd"))))
238 (build-system gnu-build-system)
251 (list (string-append "--libdir=" (assoc-ref %outputs "out")
252 "/lib/coq/user-contrib/Gappa"))
254 (modify-phases %standard-phases
255 (add-before 'configure 'fix-remake
257 (substitute* "remake.cpp"
258 (("/bin/sh") (which "sh")))))
261 (zero? (system* "./remake"))))
264 (zero? (system* "./remake" "check"))))
267 (zero? (system* "./remake" "install")))))))
268 (home-page "http://gappa.gforge.inria.fr/")
269 (synopsis "Verify and formally prove properties on numerical programs")
270 (description "Gappa is a tool intended to help verifying and formally proving
271 properties on numerical programs dealing with floating-point or fixed-point
272 arithmetic. It has been used to write robust floating-point filters for CGAL
273 and it is used to certify elementary functions in CRlibm. While Gappa is
274 intended to be used directly, it can also act as a backend prover for the Why3
275 software verification plateform or as an automatic tactic for the Coq proof
277 (license (list license:gpl2+ license:cecill))));either gpl2+ or cecill
279 (define-public coq-mathcomp
281 (name "coq-mathcomp")
285 (uri (string-append "https://github.com/math-comp/math-comp/archive/mathcomp-"
289 "05zgyi4wmasi1rcyn5jq42w0bi9713q9m8dl1fdgl66nmacixh39"))))
290 (build-system gnu-build-system)
296 `(#:tests? #f; No need to test formally-verified programs :)
298 (modify-phases %standard-phases
300 (add-before 'build 'chdir
304 (lambda* (#:key outputs #:allow-other-keys)
305 (setenv "COQLIB" (string-append (assoc-ref outputs "out") "/lib/coq/"))
306 (zero? (system* "make" "-f" "Makefile.coq"
307 (string-append "COQLIB=" (assoc-ref outputs "out")
310 (home-page "https://math-comp.github.io/math-comp/")
311 (synopsis "Mathematical Components for Coq")
312 (description "Mathematical Components for Coq has its origins in the formal
313 proof of the Four Colour Theorem. Since then it has grown to cover many areas
314 of mathematics and has been used for large scale projects like the formal proof
315 of the Odd Order Theorem.
317 The library is written using the Ssreflect proof language that is an integral
318 part of the distribution.")
319 (license license:cecill-b)))
321 (define-public coq-coquelicot
323 (name "coq-coquelicot")
327 (uri (string-append "https://gforge.inria.fr/frs/download.php/"
328 "file/37045/coquelicot-" version ".tar.gz"))
331 "0hsyhsy2lwqxxx2r8xgi5csmirss42lp9bkb9yy35mnya0w78c8r"))))
332 (build-system gnu-build-system)
338 `(("mathcomp" ,coq-mathcomp)))
341 (list (string-append "--libdir=" (assoc-ref %outputs "out")
342 "/lib/coq/user-contrib/Coquelicot"))
344 (modify-phases %standard-phases
345 (add-before 'configure 'fix-coq8.8
347 ; appcontext has been removed from coq 8.8
348 (substitute* "theories/AutoDerive.v"
349 (("appcontext") "context"))
351 (add-before 'configure 'fix-remake
353 (substitute* "remake.cpp"
354 (("/bin/sh") (which "sh")))))
357 (zero? (system* "./remake"))))
360 (zero? (system* "./remake" "check"))))
363 (zero? (system* "./remake" "install")))))))
364 (home-page "http://coquelicot.saclay.inria.fr/index.html")
365 (synopsis "Coq library for Reals")
366 (description "Coquelicot is an easier way of writing formulas and theorem
367 statements, achieved by relying on total functions in place of dependent types
368 for limits, derivatives, integrals, power series, and so on. To help with the
369 proof process, the library comes with a comprehensive set of theorems that cover
370 not only these notions, but also some extensions such as parametric integrals,
371 two-dimensional differentiability, asymptotic behaviors. It also offers some
372 automations for performing differentiability proofs. Moreover, Coquelicot is a
373 conservative extension of Coq's standard library and provides correspondence
374 theorems between the two libraries.")
375 (license license:lgpl3+)))
377 (define-public coq-bignums
383 (uri (string-append "https://github.com/coq/bignums/archive/V"
385 (file-name (string-append name "-" version ".tar.gz"))
388 "08m1cmq4hkaf4sb0vy978c11rgzvds71cphyadmr2iirpr5815r0"))))
389 (build-system gnu-build-system)
394 `(("camlp5" ,camlp5)))
396 `(#:tests? #f; No test target
398 (list (string-append "COQLIBINSTALL=" (assoc-ref %outputs "out")
399 "/lib/coq/user-contrib"))
401 (modify-phases %standard-phases
402 (delete 'configure))))
403 (home-page "https://github.com/coq/bignums")
404 (synopsis "Coq library for arbitrary large numbers")
405 (description "Bignums is a coq library of arbitrary large numbers. It
406 provides BigN, BigZ, BigQ that used to be part of Coq standard library.")
407 (license license:lgpl2.1+)))
409 (define-public coq-interval
411 (name "coq-interval")
415 (uri (string-append "https://gforge.inria.fr/frs/download.php/"
416 "file/37077/interval-" version ".tar.gz"))
419 "08fdcf3hbwqphglvwprvqzgkg0qbimpyhnqsgv3gac4y1ap0f903"))))
420 (build-system gnu-build-system)
426 `(("flocq" ,coq-flocq)
427 ("bignums" ,coq-bignums)
428 ("coquelicot" ,coq-coquelicot)
429 ("mathcomp" ,coq-mathcomp)))
432 (list (string-append "--libdir=" (assoc-ref %outputs "out")
433 "/lib/coq/user-contrib/Gappa"))
435 (modify-phases %standard-phases
436 (add-before 'configure 'fix-remake
438 (substitute* "remake.cpp"
439 (("/bin/sh") (which "sh")))))
442 (zero? (system* "./remake"))))
445 (zero? (system* "./remake" "check"))))
448 (zero? (system* "./remake" "install")))))))
449 (home-page "http://coq-interval.gforge.inria.fr/")
450 (synopsis "Coq tactics to simplify inequality proofs")
451 (description "Interval provides vernacular files containing tactics for
452 simplifying the proofs of inequalities on expressions of real numbers for the
453 Coq proof assistant.")
454 (license license:cecill-c)))