1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2018 Julien Lepiller <julien@lepiller.eu>
3 ;;; Copyright © 2019 Dan Frumin <dfrumin@cs.ru.nl>
5 ;;; This file is part of GNU Guix.
7 ;;; GNU Guix is free software; you can redistribute it and/or modify it
8 ;;; under the terms of the GNU General Public License as published by
9 ;;; the Free Software Foundation; either version 3 of the License, or (at
10 ;;; your option) any later version.
12 ;;; GNU Guix is distributed in the hope that it will be useful, but
13 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;;; GNU General Public License for more details.
17 ;;; You should have received a copy of the GNU General Public License
18 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
20 (define-module (gnu packages coq)
21 #:use-module (gnu packages)
22 #:use-module (gnu packages base)
23 #:use-module (gnu packages bison)
24 #:use-module (gnu packages boost)
25 #:use-module (gnu packages emacs)
26 #:use-module (gnu packages flex)
27 #:use-module (gnu packages multiprecision)
28 #:use-module (gnu packages ocaml)
29 #:use-module (gnu packages perl)
30 #:use-module (gnu packages python)
31 #:use-module (gnu packages texinfo)
32 #:use-module (guix build-system gnu)
33 #:use-module (guix build-system ocaml)
34 #:use-module (guix download)
35 #:use-module (guix git-download)
36 #:use-module ((guix licenses) #:prefix license:)
37 #:use-module (guix packages)
38 #:use-module (guix utils)
39 #:use-module ((srfi srfi-1) #:hide (zip)))
47 (uri (string-append "https://github.com/coq/coq/archive/V"
49 (file-name (string-append name "-" version ".tar.gz"))
52 "0i2hs0i6rp27cy8zd0mx7jscqw5cx2y0diw0pxgij66s3yr47y7r"))))
54 (list (search-path-specification
56 (files (list "lib/coq/user-contrib")))))
57 (build-system ocaml-build-system)
59 `(("lablgtk" ,lablgtk)
62 ("ocaml-num" ,ocaml-num)))
65 (modify-phases %standard-phases
67 (lambda* (#:key outputs #:allow-other-keys)
68 (let* ((out (assoc-ref outputs "out"))
69 (mandir (string-append out "/share/man"))
70 (browser "icecat -remote \"OpenURL(%s,new-tab)\""))
79 "-j" (number->string (parallel-job-count))
82 (add-after 'install 'check
84 (with-directory-excursion "test-suite"
85 ;; These two tests fail.
86 ;; This one fails because the output is not formatted as expected.
87 (delete-file-recursively "coq-makefile/timing")
88 ;; This one fails because we didn't build coqtop.byte.
89 (delete-file-recursively "coq-makefile/findlib-package")
91 (home-page "https://coq.inria.fr")
92 (synopsis "Proof assistant for higher-order logic")
94 "Coq is a proof assistant for higher-order logic, which allows the
95 development of computer programs consistent with their formal specification.
96 It is developed using Objective Caml and Camlp5.")
97 ;; The code is distributed under lgpl2.1.
98 ;; Some of the documentation is distributed under opl1.0+.
99 (license (list license:lgpl2.1 license:opl1.0+))))
101 (define-public proof-general
103 (name "proof-general")
108 "http://proofgeneral.inf.ed.ac.uk/releases/"
109 "ProofGeneral-" version ".tgz"))
112 "09qb0myq66fw17v4ziz401ilsb5xlxz1nl2wsp69d0vrfy0bcrrm"))))
113 (build-system gnu-build-system)
116 ("emacs" ,emacs-minimal)
117 ("texinfo" ,texinfo)))
119 `(("host-emacs" ,emacs)
123 `(#:tests? #f ; no check target
124 #:make-flags (list (string-append "PREFIX=" %output)
125 (string-append "DEST_PREFIX=" %output))
126 #:modules ((guix build gnu-build-system)
128 (guix build emacs-utils))
129 #:imported-modules (,@%gnu-build-system-modules
130 (guix build emacs-utils))
132 (modify-phases %standard-phases
134 (add-after 'unpack 'disable-byte-compile-error-on-warn
136 (substitute* "Makefile"
137 (("\\(setq byte-compile-error-on-warn t\\)")
138 "(setq byte-compile-error-on-warn nil)"))
140 (add-after 'unpack 'patch-hardcoded-paths
141 (lambda* (#:key inputs outputs #:allow-other-keys)
142 (let ((out (assoc-ref outputs "out"))
143 (coq (assoc-ref inputs "coq"))
144 (emacs (assoc-ref inputs "host-emacs")))
145 (define (coq-prog name)
146 (string-append coq "/bin/" name))
147 (emacs-substitute-variables "coq/coq.el"
148 ("coq-prog-name" (coq-prog "coqtop"))
149 ("coq-compiler" (coq-prog "coqc"))
150 ("coq-dependency-analyzer" (coq-prog "coqdep")))
151 (substitute* "Makefile"
152 (("/sbin/install-info") "install-info"))
153 (substitute* "bin/proofgeneral"
154 (("^PGHOMEDEFAULT=.*" all)
156 "PGHOME=$PGHOMEDEFAULT\n"
157 "EMACS=" emacs "/bin/emacs")))
159 (add-after 'unpack 'clean
161 ;; Delete the pre-compiled elc files for Emacs 23.
162 (invoke "make" "clean")))
163 (add-after 'install 'install-doc
164 (lambda* (#:key make-flags #:allow-other-keys)
165 ;; XXX FIXME avoid building/installing pdf files,
166 ;; due to unresolved errors building them.
167 (substitute* "Makefile"
168 ((" [^ ]*\\.pdf") ""))
169 (apply invoke "make" "install-doc" make-flags))))))
170 (home-page "http://proofgeneral.inf.ed.ac.uk/")
171 (synopsis "Generic front-end for proof assistants based on Emacs")
173 "Proof General is a major mode to turn Emacs into an interactive proof
174 assistant to write formal mathematical proofs using a variety of theorem
176 (license license:gpl2+)))
178 (define-public coq-flocq
184 ;; Use the ‘Latest version’ link for a stable URI across releases.
185 (uri (string-append "https://gforge.inria.fr/frs/download.php/"
186 "file/37454/flocq-" version ".tar.gz"))
189 "06msp1fwpqv6p98a3i1nnkj7ch9rcq3rm916yxq8dxf51lkghrin"))))
190 (build-system gnu-build-system)
197 (list (string-append "--libdir=" (assoc-ref %outputs "out")
198 "/lib/coq/user-contrib/Flocq"))
200 (modify-phases %standard-phases
201 (add-before 'configure 'fix-remake
203 (substitute* "remake.cpp"
204 (("/bin/sh") (which "sh")))
212 (invoke "./remake" "check")
214 ;; TODO: requires coq-gappa and coq-interval.
215 ;(invoke "./remake" "check-more")
218 (invoke "./remake" "install")
220 (home-page "http://flocq.gforge.inria.fr/")
221 (synopsis "Floating-point formalization for the Coq system")
222 (description "Flocq (Floats for Coq) is a floating-point formalization for
223 the Coq system. It provides a comprehensive library of theorems on a multi-radix
224 multi-precision arithmetic. It also supports efficient numerical computations
226 (license license:lgpl3+)))
228 (define-public coq-gappa
234 (uri (string-append "https://gforge.inria.fr/frs/download.php/file/36397/gappa-"
238 "19kg2zldaqs4smy7bv9hp650sqg46xbx1ss7jnyagpxdscwn9apd"))))
239 (build-system gnu-build-system)
252 (list (string-append "--libdir=" (assoc-ref %outputs "out")
253 "/lib/coq/user-contrib/Gappa"))
255 (modify-phases %standard-phases
256 (add-before 'configure 'fix-remake
258 (substitute* "remake.cpp"
259 (("/bin/sh") (which "sh")))
262 (lambda _ (invoke "./remake")))
264 (lambda _ (invoke "./remake" "check")))
266 (lambda _ (invoke "./remake" "install"))))))
267 (home-page "http://gappa.gforge.inria.fr/")
268 (synopsis "Verify and formally prove properties on numerical programs")
269 (description "Gappa is a tool intended to help verifying and formally proving
270 properties on numerical programs dealing with floating-point or fixed-point
271 arithmetic. It has been used to write robust floating-point filters for CGAL
272 and it is used to certify elementary functions in CRlibm. While Gappa is
273 intended to be used directly, it can also act as a backend prover for the Why3
274 software verification plateform or as an automatic tactic for the Coq proof
276 (license (list license:gpl2+ license:cecill))));either gpl2+ or cecill
278 (define-public coq-mathcomp
280 (name "coq-mathcomp")
284 (uri (string-append "https://github.com/math-comp/math-comp/archive/mathcomp-"
288 "05zgyi4wmasi1rcyn5jq42w0bi9713q9m8dl1fdgl66nmacixh39"))))
289 (build-system gnu-build-system)
295 `(#:tests? #f; No need to test formally-verified programs :)
297 (modify-phases %standard-phases
299 (add-before 'build 'chdir
300 (lambda _ (chdir "mathcomp") #t))
302 (lambda* (#:key outputs #:allow-other-keys)
303 (setenv "COQLIB" (string-append (assoc-ref outputs "out") "/lib/coq/"))
304 (invoke "make" "-f" "Makefile.coq"
305 (string-append "COQLIB=" (assoc-ref outputs "out")
308 (home-page "https://math-comp.github.io/math-comp/")
309 (synopsis "Mathematical Components for Coq")
310 (description "Mathematical Components for Coq has its origins in the formal
311 proof of the Four Colour Theorem. Since then it has grown to cover many areas
312 of mathematics and has been used for large scale projects like the formal proof
313 of the Odd Order Theorem.
315 The library is written using the Ssreflect proof language that is an integral
316 part of the distribution.")
317 (license license:cecill-b)))
319 (define-public coq-coquelicot
321 (name "coq-coquelicot")
325 (uri (string-append "https://gforge.inria.fr/frs/download.php/"
326 "file/37045/coquelicot-" version ".tar.gz"))
329 "0hsyhsy2lwqxxx2r8xgi5csmirss42lp9bkb9yy35mnya0w78c8r"))))
330 (build-system gnu-build-system)
336 `(("mathcomp" ,coq-mathcomp)))
339 (list (string-append "--libdir=" (assoc-ref %outputs "out")
340 "/lib/coq/user-contrib/Coquelicot"))
342 (modify-phases %standard-phases
343 (add-before 'configure 'fix-coq8.8
345 ; appcontext has been removed from coq 8.8
346 (substitute* "theories/AutoDerive.v"
347 (("appcontext") "context"))
349 (add-before 'configure 'fix-remake
351 (substitute* "remake.cpp"
352 (("/bin/sh") (which "sh")))
355 (lambda _ (invoke "./remake")))
357 (lambda _ (invoke "./remake" "check")))
359 (lambda _ (invoke "./remake" "install"))))))
360 (home-page "http://coquelicot.saclay.inria.fr/index.html")
361 (synopsis "Coq library for Reals")
362 (description "Coquelicot is an easier way of writing formulas and theorem
363 statements, achieved by relying on total functions in place of dependent types
364 for limits, derivatives, integrals, power series, and so on. To help with the
365 proof process, the library comes with a comprehensive set of theorems that cover
366 not only these notions, but also some extensions such as parametric integrals,
367 two-dimensional differentiability, asymptotic behaviors. It also offers some
368 automations for performing differentiability proofs. Moreover, Coquelicot is a
369 conservative extension of Coq's standard library and provides correspondence
370 theorems between the two libraries.")
371 (license license:lgpl3+)))
373 (define-public coq-bignums
379 (uri (string-append "https://github.com/coq/bignums/archive/V"
381 (file-name (string-append name "-" version ".tar.gz"))
384 "08m1cmq4hkaf4sb0vy978c11rgzvds71cphyadmr2iirpr5815r0"))))
385 (build-system gnu-build-system)
390 `(("camlp5" ,camlp5)))
392 `(#:tests? #f; No test target
394 (list (string-append "COQLIBINSTALL=" (assoc-ref %outputs "out")
395 "/lib/coq/user-contrib"))
397 (modify-phases %standard-phases
398 (delete 'configure))))
399 (home-page "https://github.com/coq/bignums")
400 (synopsis "Coq library for arbitrary large numbers")
401 (description "Bignums is a coq library of arbitrary large numbers. It
402 provides BigN, BigZ, BigQ that used to be part of Coq standard library.")
403 (license license:lgpl2.1+)))
405 (define-public coq-interval
407 (name "coq-interval")
411 (uri (string-append "https://gforge.inria.fr/frs/download.php/"
412 "file/37077/interval-" version ".tar.gz"))
415 "08fdcf3hbwqphglvwprvqzgkg0qbimpyhnqsgv3gac4y1ap0f903"))))
416 (build-system gnu-build-system)
422 `(("flocq" ,coq-flocq)
423 ("bignums" ,coq-bignums)
424 ("coquelicot" ,coq-coquelicot)
425 ("mathcomp" ,coq-mathcomp)))
428 (list (string-append "--libdir=" (assoc-ref %outputs "out")
429 "/lib/coq/user-contrib/Gappa"))
431 (modify-phases %standard-phases
432 (add-before 'configure 'fix-remake
434 (substitute* "remake.cpp"
435 (("/bin/sh") (which "sh")))
438 (lambda _ (invoke "./remake")))
440 (lambda _ (invoke "./remake" "check")))
442 (lambda _ (invoke "./remake" "install"))))))
443 (home-page "http://coq-interval.gforge.inria.fr/")
444 (synopsis "Coq tactics to simplify inequality proofs")
445 (description "Interval provides vernacular files containing tactics for
446 simplifying the proofs of inequalities on expressions of real numbers for the
447 Coq proof assistant.")
448 (license license:cecill-c)))
450 (define-public coq-autosubst
451 ;; Latest commit on that branch, where work on supporting coq 8.6 and
452 ;; more recent versions of coq happen.
453 (let ((branch "coq86-devel")
454 (commit "d0d73557979796b3d4be7aac72135581c33f26f7"))
456 (name "coq-autosubst")
457 (version (git-version "1" branch commit))
461 (url "git://github.com/uds-psl/autosubst.git")
463 (file-name (git-file-name name version))
465 (base32 "1852xb5cwkjw3dlc0lp2sakwa40bjzw37qmwz4bn3vqazg1hnh6r"))))
466 (build-system gnu-build-system)
470 (modify-phases %standard-phases
473 (lambda* (#:key outputs #:allow-other-keys)
474 (setenv "COQLIB" (string-append (assoc-ref outputs "out") "/lib/coq/"))
476 (string-append "COQLIB=" (assoc-ref outputs "out")
481 (home-page "https://www.ps.uni-saarland.de/autosubst/")
482 (synopsis "Coq library for parallel de Bruijn substitutions")
483 (description "Formalizing syntactic theories with variable binders is
484 not easy. Autosubst is a library for the Coq proof assistant to
485 automate this process. Given an inductive definition of syntactic objects in
486 de Bruijn representation augmented with binding annotations, Autosubst
487 synthesizes the parallel substitution operation and automatically proves the
488 basic lemmas about substitutions. This library contains an automation
489 tactic that solves equations involving terms and substitutions. This makes the
490 usage of substitution lemmas unnecessary. The tactic is based on our current
491 work on a decision procedure for the equational theory of an extension of the
492 sigma-calculus by Abadi et al. The library is completely written in Coq and
493 uses Ltac to synthesize the substitution operation.")
494 (license license:bsd-3))))