1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2018 Julien Lepiller <julien@lepiller.eu>
3 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
4 ;;; Copyright © 2019 Dan Frumin <dfrumin@cs.ru.nl>
6 ;;; This file is part of GNU Guix.
8 ;;; GNU Guix is free software; you can redistribute it and/or modify it
9 ;;; under the terms of the GNU General Public License as published by
10 ;;; the Free Software Foundation; either version 3 of the License, or (at
11 ;;; your option) any later version.
13 ;;; GNU Guix is distributed in the hope that it will be useful, but
14 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;;; GNU General Public License for more details.
18 ;;; You should have received a copy of the GNU General Public License
19 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21 (define-module (gnu packages coq)
22 #:use-module (gnu packages)
23 #:use-module (gnu packages base)
24 #:use-module (gnu packages bison)
25 #:use-module (gnu packages boost)
26 #:use-module (gnu packages emacs)
27 #:use-module (gnu packages flex)
28 #:use-module (gnu packages multiprecision)
29 #:use-module (gnu packages ocaml)
30 #:use-module (gnu packages perl)
31 #:use-module (gnu packages python)
32 #:use-module (gnu packages texinfo)
33 #:use-module (guix build-system gnu)
34 #:use-module (guix build-system ocaml)
35 #:use-module (guix download)
36 #:use-module (guix git-download)
37 #:use-module ((guix licenses) #:prefix license:)
38 #:use-module (guix packages)
39 #:use-module (guix utils)
40 #:use-module ((srfi srfi-1) #:hide (zip)))
50 (url "https://github.com/coq/coq.git")
51 (commit (string-append "V" version))))
52 (file-name (git-file-name name version))
54 (base32 "03v8b57mz3ivsijwxy51avzwiyhla5ijaf98a5a2q29yabdq8dkp"))))
56 (list (search-path-specification
58 (files (list "lib/coq/user-contrib")))))
59 (build-system ocaml-build-system)
61 `(("lablgtk" ,lablgtk)
64 ("ocaml-num" ,ocaml-num)))
67 (modify-phases %standard-phases
68 (add-after 'unpack 'make-git-checkout-writable
70 (for-each make-file-writable (find-files "."))
73 (lambda* (#:key outputs #:allow-other-keys)
74 (let* ((out (assoc-ref outputs "out"))
75 (mandir (string-append out "/share/man"))
76 (browser "icecat -remote \"OpenURL(%s,new-tab)\""))
85 "-j" (number->string (parallel-job-count))
88 (add-after 'install 'check
90 (with-directory-excursion "test-suite"
91 ;; These two tests fail.
92 ;; This one fails because the output is not formatted as expected.
93 (delete-file-recursively "coq-makefile/timing")
94 ;; This one fails because we didn't build coqtop.byte.
95 (delete-file-recursively "coq-makefile/findlib-package")
97 (home-page "https://coq.inria.fr")
98 (synopsis "Proof assistant for higher-order logic")
100 "Coq is a proof assistant for higher-order logic, which allows the
101 development of computer programs consistent with their formal specification.
102 It is developed using Objective Caml and Camlp5.")
103 ;; The code is distributed under lgpl2.1.
104 ;; Some of the documentation is distributed under opl1.0+.
105 (license (list license:lgpl2.1 license:opl1.0+))))
107 (define-public proof-general
109 (name "proof-general")
114 "http://proofgeneral.inf.ed.ac.uk/releases/"
115 "ProofGeneral-" version ".tgz"))
118 "09qb0myq66fw17v4ziz401ilsb5xlxz1nl2wsp69d0vrfy0bcrrm"))))
119 (build-system gnu-build-system)
122 ("emacs" ,emacs-minimal)
123 ("texinfo" ,texinfo)))
125 `(("host-emacs" ,emacs)
129 `(#:tests? #f ; no check target
130 #:make-flags (list (string-append "PREFIX=" %output)
131 (string-append "DEST_PREFIX=" %output))
132 #:modules ((guix build gnu-build-system)
134 (guix build emacs-utils))
135 #:imported-modules (,@%gnu-build-system-modules
136 (guix build emacs-utils))
138 (modify-phases %standard-phases
140 (add-after 'unpack 'disable-byte-compile-error-on-warn
142 (substitute* "Makefile"
143 (("\\(setq byte-compile-error-on-warn t\\)")
144 "(setq byte-compile-error-on-warn nil)"))
146 (add-after 'unpack 'patch-hardcoded-paths
147 (lambda* (#:key inputs outputs #:allow-other-keys)
148 (let ((out (assoc-ref outputs "out"))
149 (coq (assoc-ref inputs "coq"))
150 (emacs (assoc-ref inputs "host-emacs")))
151 (define (coq-prog name)
152 (string-append coq "/bin/" name))
153 (emacs-substitute-variables "coq/coq.el"
154 ("coq-prog-name" (coq-prog "coqtop"))
155 ("coq-compiler" (coq-prog "coqc"))
156 ("coq-dependency-analyzer" (coq-prog "coqdep")))
157 (substitute* "Makefile"
158 (("/sbin/install-info") "install-info"))
159 (substitute* "bin/proofgeneral"
160 (("^PGHOMEDEFAULT=.*" all)
162 "PGHOME=$PGHOMEDEFAULT\n"
163 "EMACS=" emacs "/bin/emacs")))
165 (add-after 'unpack 'clean
167 ;; Delete the pre-compiled elc files for Emacs 23.
168 (invoke "make" "clean")))
169 (add-after 'install 'install-doc
170 (lambda* (#:key make-flags #:allow-other-keys)
171 ;; XXX FIXME avoid building/installing pdf files,
172 ;; due to unresolved errors building them.
173 (substitute* "Makefile"
174 ((" [^ ]*\\.pdf") ""))
175 (apply invoke "make" "install-doc" make-flags))))))
176 (home-page "http://proofgeneral.inf.ed.ac.uk/")
177 (synopsis "Generic front-end for proof assistants based on Emacs")
179 "Proof General is a major mode to turn Emacs into an interactive proof
180 assistant to write formal mathematical proofs using a variety of theorem
182 (license license:gpl2+)))
184 (define-public coq-flocq
190 ;; Use the ‘Latest version’ link for a stable URI across releases.
191 (uri (string-append "https://gforge.inria.fr/frs/download.php/"
192 "file/37901/flocq-" version ".tar.gz"))
195 "02szrgz9m0ac51la1lqpiv6i2g0zbgx9gz5rp0q1g00ajldyna5c"))))
196 (build-system gnu-build-system)
203 (list (string-append "--libdir=" (assoc-ref %outputs "out")
204 "/lib/coq/user-contrib/Flocq"))
206 (modify-phases %standard-phases
207 (add-before 'configure 'fix-remake
209 (substitute* "remake.cpp"
210 (("/bin/sh") (which "sh")))
218 (invoke "./remake" "check")
220 ;; TODO: requires coq-gappa and coq-interval.
221 ;(invoke "./remake" "check-more")
224 (invoke "./remake" "install")
226 (home-page "http://flocq.gforge.inria.fr/")
227 (synopsis "Floating-point formalization for the Coq system")
228 (description "Flocq (Floats for Coq) is a floating-point formalization for
229 the Coq system. It provides a comprehensive library of theorems on a multi-radix
230 multi-precision arithmetic. It also supports efficient numerical computations
232 (license license:lgpl3+)))
234 (define-public coq-gappa
240 (uri (string-append "https://gforge.inria.fr/frs/download.php/file/36397/gappa-"
244 "19kg2zldaqs4smy7bv9hp650sqg46xbx1ss7jnyagpxdscwn9apd"))))
245 (build-system gnu-build-system)
258 (list (string-append "--libdir=" (assoc-ref %outputs "out")
259 "/lib/coq/user-contrib/Gappa"))
261 (modify-phases %standard-phases
262 (add-before 'configure 'fix-remake
264 (substitute* "remake.cpp"
265 (("/bin/sh") (which "sh")))
268 (lambda _ (invoke "./remake")))
270 (lambda _ (invoke "./remake" "check")))
272 (lambda _ (invoke "./remake" "install"))))))
273 (home-page "http://gappa.gforge.inria.fr/")
274 (synopsis "Verify and formally prove properties on numerical programs")
275 (description "Gappa is a tool intended to help verifying and formally proving
276 properties on numerical programs dealing with floating-point or fixed-point
277 arithmetic. It has been used to write robust floating-point filters for CGAL
278 and it is used to certify elementary functions in CRlibm. While Gappa is
279 intended to be used directly, it can also act as a backend prover for the Why3
280 software verification plateform or as an automatic tactic for the Coq proof
282 (license (list license:gpl2+ license:cecill))));either gpl2+ or cecill
284 (define-public coq-mathcomp
286 (name "coq-mathcomp")
292 (url "https://github.com/math-comp/math-comp.git")
293 (commit (string-append "mathcomp-" version))))
294 (file-name (git-file-name name version))
296 (base32 "1cdzi67jj440xkdpxm10aly80zpn56vjzj2ygb67iq3xpljlv95h"))))
297 (build-system gnu-build-system)
303 `(#:tests? #f ; no need to test formally-verified programs :)
305 (modify-phases %standard-phases
307 (add-before 'build 'chdir
308 (lambda _ (chdir "mathcomp") #t))
310 (lambda* (#:key outputs #:allow-other-keys)
311 (setenv "COQLIB" (string-append (assoc-ref outputs "out") "/lib/coq/"))
312 (invoke "make" "-f" "Makefile.coq"
313 (string-append "COQLIB=" (assoc-ref outputs "out")
316 (home-page "https://math-comp.github.io/math-comp/")
317 (synopsis "Mathematical Components for Coq")
318 (description "Mathematical Components for Coq has its origins in the formal
319 proof of the Four Colour Theorem. Since then it has grown to cover many areas
320 of mathematics and has been used for large scale projects like the formal proof
321 of the Odd Order Theorem.
323 The library is written using the Ssreflect proof language that is an integral
324 part of the distribution.")
325 (license license:cecill-b)))
327 (define-public coq-coquelicot
329 (name "coq-coquelicot")
333 (uri (string-append "https://gforge.inria.fr/frs/download.php/"
334 "file/37523/coquelicot-" version ".tar.gz"))
337 "1biia7nfqf7vaqq5gmykl4rwjyvrcwss6r2jdf0in5pvp2rnrj2w"))))
338 (build-system gnu-build-system)
344 `(("mathcomp" ,coq-mathcomp)))
347 (list (string-append "--libdir=" (assoc-ref %outputs "out")
348 "/lib/coq/user-contrib/Coquelicot"))
350 (modify-phases %standard-phases
351 (add-before 'configure 'fix-remake
353 (substitute* "remake.cpp"
354 (("/bin/sh") (which "sh")))
357 (lambda _ (invoke "./remake")))
359 (lambda _ (invoke "./remake" "check")))
361 (lambda _ (invoke "./remake" "install"))))))
362 (home-page "http://coquelicot.saclay.inria.fr/index.html")
363 (synopsis "Coq library for Reals")
364 (description "Coquelicot is an easier way of writing formulas and theorem
365 statements, achieved by relying on total functions in place of dependent types
366 for limits, derivatives, integrals, power series, and so on. To help with the
367 proof process, the library comes with a comprehensive set of theorems that cover
368 not only these notions, but also some extensions such as parametric integrals,
369 two-dimensional differentiability, asymptotic behaviors. It also offers some
370 automations for performing differentiability proofs. Moreover, Coquelicot is a
371 conservative extension of Coq's standard library and provides correspondence
372 theorems between the two libraries.")
373 (license license:lgpl3+)))
375 (define-public coq-bignums
381 (uri (string-append "https://github.com/coq/bignums/archive/V"
383 (file-name (string-append name "-" version ".tar.gz"))
386 "08m1cmq4hkaf4sb0vy978c11rgzvds71cphyadmr2iirpr5815r0"))))
387 (build-system gnu-build-system)
392 `(("camlp5" ,camlp5)))
394 `(#:tests? #f; No test target
396 (list (string-append "COQLIBINSTALL=" (assoc-ref %outputs "out")
397 "/lib/coq/user-contrib"))
399 (modify-phases %standard-phases
400 (delete 'configure))))
401 (home-page "https://github.com/coq/bignums")
402 (synopsis "Coq library for arbitrary large numbers")
403 (description "Bignums is a coq library of arbitrary large numbers. It
404 provides BigN, BigZ, BigQ that used to be part of Coq standard library.")
405 (license license:lgpl2.1+)))
407 (define-public coq-interval
409 (name "coq-interval")
413 (uri (string-append "https://gforge.inria.fr/frs/download.php/"
414 "file/37524/interval-" version ".tar.gz"))
417 "023j9sd64brqvjdidqkn5m8d7a93zd9r86ggh573z9nkjm2m7vvg"))))
418 (build-system gnu-build-system)
424 `(("flocq" ,coq-flocq)
425 ("bignums" ,coq-bignums)
426 ("coquelicot" ,coq-coquelicot)
427 ("mathcomp" ,coq-mathcomp)))
430 (list (string-append "--libdir=" (assoc-ref %outputs "out")
431 "/lib/coq/user-contrib/Gappa"))
433 (modify-phases %standard-phases
434 (add-before 'configure 'fix-remake
436 (substitute* "remake.cpp"
437 (("/bin/sh") (which "sh")))
440 (lambda _ (invoke "./remake")))
442 (lambda _ (invoke "./remake" "check")))
444 (lambda _ (invoke "./remake" "install"))))))
445 (home-page "http://coq-interval.gforge.inria.fr/")
446 (synopsis "Coq tactics to simplify inequality proofs")
447 (description "Interval provides vernacular files containing tactics for
448 simplifying the proofs of inequalities on expressions of real numbers for the
449 Coq proof assistant.")
450 (license license:cecill-c)))
452 (define-public coq-autosubst
453 ;; Latest commit on that branch, where work on supporting coq 8.6 and
454 ;; more recent versions of coq happen.
455 (let ((branch "coq86-devel")
456 (commit "d0d73557979796b3d4be7aac72135581c33f26f7"))
458 (name "coq-autosubst")
459 (version (git-version "1" branch commit))
463 (url "git://github.com/uds-psl/autosubst.git")
465 (file-name (git-file-name name version))
467 (base32 "1852xb5cwkjw3dlc0lp2sakwa40bjzw37qmwz4bn3vqazg1hnh6r"))))
468 (build-system gnu-build-system)
472 (modify-phases %standard-phases
475 (lambda* (#:key outputs #:allow-other-keys)
476 (setenv "COQLIB" (string-append (assoc-ref outputs "out") "/lib/coq/"))
478 (string-append "COQLIB=" (assoc-ref outputs "out")
483 (home-page "https://www.ps.uni-saarland.de/autosubst/")
484 (synopsis "Coq library for parallel de Bruijn substitutions")
485 (description "Formalizing syntactic theories with variable binders is
486 not easy. Autosubst is a library for the Coq proof assistant to
487 automate this process. Given an inductive definition of syntactic objects in
488 de Bruijn representation augmented with binding annotations, Autosubst
489 synthesizes the parallel substitution operation and automatically proves the
490 basic lemmas about substitutions. This library contains an automation
491 tactic that solves equations involving terms and substitutions. This makes the
492 usage of substitution lemmas unnecessary. The tactic is based on our current
493 work on a decision procedure for the equational theory of an extension of the
494 sigma-calculus by Abadi et al. The library is completely written in Coq and
495 uses Ltac to synthesize the substitution operation.")
496 (license license:bsd-3))))
498 (define-public coq-equations
500 (name "coq-equations")
505 (url "https://github.com/mattam82/Coq-Equations.git")
506 (commit (string-append "v" version "-8.8"))))
507 (file-name (git-file-name name version))
510 "129rxsdsf88vjcw0xhm74yax1hmnk6f8n9ksg0hcyyjq1ijddiwa"))))
511 (build-system gnu-build-system)
517 `(#:test-target "test-suite"
519 (modify-phases %standard-phases
521 (lambda* (#:key outputs #:allow-other-keys)
522 (invoke "coq_makefile" "-f" "_CoqProject" "-o" "Makefile")))
524 (lambda* (#:key outputs #:allow-other-keys)
525 (setenv "COQLIB" (string-append (assoc-ref outputs "out") "/lib/coq/"))
527 (string-append "COQLIB=" (assoc-ref outputs "out")
530 (home-page "https://mattam82.github.io/Coq-Equations/")
531 (synopsis "Function definition plugin for Coq")
532 (description "Equations provides a notation for writing programs
533 by dependent pattern-matching and (well-founded) recursion in Coq. It
534 compiles everything down to eliminators for inductive types, equality
535 and accessibility, providing a definitional extension to the Coq
537 (license license:lgpl2.1)))