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 gawk)
29 #:use-module (gnu packages multiprecision)
30 #:use-module (gnu packages ocaml)
31 #:use-module (gnu packages perl)
32 #:use-module (gnu packages python)
33 #:use-module (gnu packages texinfo)
34 #:use-module (guix build-system gnu)
35 #:use-module (guix build-system ocaml)
36 #:use-module (guix download)
37 #:use-module (guix git-download)
38 #:use-module ((guix licenses) #:prefix license:)
39 #:use-module (guix packages)
40 #:use-module (guix utils)
41 #:use-module ((srfi srfi-1) #:hide (zip)))
51 (url "https://github.com/coq/coq.git")
52 (commit (string-append "V" version))))
53 (file-name (git-file-name name version))
55 (base32 "01ad7az6f95w16xya7979lk32agy22lf4bqgqf5qpnarpkpxhbw8"))))
57 (list (search-path-specification
59 (files (list "lib/coq/user-contrib")))))
60 (build-system ocaml-build-system)
62 `(("lablgtk" ,lablgtk)
65 ("ocaml-num" ,ocaml-num)))
67 `(("ocaml-ounit" ,ocaml-ounit)))
70 (modify-phases %standard-phases
71 (add-after 'unpack 'make-git-checkout-writable
73 (for-each make-file-writable (find-files "."))
76 (lambda* (#:key outputs #:allow-other-keys)
77 (let* ((out (assoc-ref outputs "out"))
78 (mandir (string-append out "/share/man"))
79 (browser "icecat -remote \"OpenURL(%s,new-tab)\""))
88 "-j" (number->string (parallel-job-count))
91 (add-after 'install 'check
93 (with-directory-excursion "test-suite"
94 ;; These two tests fail.
95 ;; This one fails because the output is not formatted as expected.
96 (delete-file-recursively "coq-makefile/timing")
97 ;; This one fails because we didn't build coqtop.byte.
98 (delete-file-recursively "coq-makefile/findlib-package")
100 (home-page "https://coq.inria.fr")
101 (synopsis "Proof assistant for higher-order logic")
103 "Coq is a proof assistant for higher-order logic, which allows the
104 development of computer programs consistent with their formal specification.
105 It is developed using Objective Caml and Camlp5.")
106 ;; The code is distributed under lgpl2.1.
107 ;; Some of the documentation is distributed under opl1.0+.
108 (license (list license:lgpl2.1 license:opl1.0+))))
110 (define-public proof-general
112 (name "proof-general")
117 "http://proofgeneral.inf.ed.ac.uk/releases/"
118 "ProofGeneral-" version ".tgz"))
121 "09qb0myq66fw17v4ziz401ilsb5xlxz1nl2wsp69d0vrfy0bcrrm"))))
122 (build-system gnu-build-system)
125 ("emacs" ,emacs-minimal)
126 ("texinfo" ,texinfo)))
128 `(("host-emacs" ,emacs)
132 `(#:tests? #f ; no check target
133 #:make-flags (list (string-append "PREFIX=" %output)
134 (string-append "DEST_PREFIX=" %output))
135 #:modules ((guix build gnu-build-system)
137 (guix build emacs-utils))
138 #:imported-modules (,@%gnu-build-system-modules
139 (guix build emacs-utils))
141 (modify-phases %standard-phases
143 (add-after 'unpack 'disable-byte-compile-error-on-warn
145 (substitute* "Makefile"
146 (("\\(setq byte-compile-error-on-warn t\\)")
147 "(setq byte-compile-error-on-warn nil)"))
149 (add-after 'unpack 'patch-hardcoded-paths
150 (lambda* (#:key inputs outputs #:allow-other-keys)
151 (let ((out (assoc-ref outputs "out"))
152 (coq (assoc-ref inputs "coq"))
153 (emacs (assoc-ref inputs "host-emacs")))
154 (define (coq-prog name)
155 (string-append coq "/bin/" name))
156 (emacs-substitute-variables "coq/coq.el"
157 ("coq-prog-name" (coq-prog "coqtop"))
158 ("coq-compiler" (coq-prog "coqc"))
159 ("coq-dependency-analyzer" (coq-prog "coqdep")))
160 (substitute* "Makefile"
161 (("/sbin/install-info") "install-info"))
162 (substitute* "bin/proofgeneral"
163 (("^PGHOMEDEFAULT=.*" all)
165 "PGHOME=$PGHOMEDEFAULT\n"
166 "EMACS=" emacs "/bin/emacs")))
168 (add-after 'unpack 'clean
170 ;; Delete the pre-compiled elc files for Emacs 23.
171 (invoke "make" "clean")))
172 (add-after 'install 'install-doc
173 (lambda* (#:key make-flags #:allow-other-keys)
174 ;; XXX FIXME avoid building/installing pdf files,
175 ;; due to unresolved errors building them.
176 (substitute* "Makefile"
177 ((" [^ ]*\\.pdf") ""))
178 (apply invoke "make" "install-doc" make-flags))))))
179 (home-page "http://proofgeneral.inf.ed.ac.uk/")
180 (synopsis "Generic front-end for proof assistants based on Emacs")
182 "Proof General is a major mode to turn Emacs into an interactive proof
183 assistant to write formal mathematical proofs using a variety of theorem
185 (license license:gpl2+)))
187 (define-public coq-flocq
193 ;; Use the ‘Latest version’ link for a stable URI across releases.
194 (uri (string-append "https://gforge.inria.fr/frs/download.php/"
195 "file/37901/flocq-" version ".tar.gz"))
198 "02szrgz9m0ac51la1lqpiv6i2g0zbgx9gz5rp0q1g00ajldyna5c"))))
199 (build-system gnu-build-system)
206 (list (string-append "--libdir=" (assoc-ref %outputs "out")
207 "/lib/coq/user-contrib/Flocq"))
209 (modify-phases %standard-phases
210 (add-before 'configure 'fix-remake
212 (substitute* "remake.cpp"
213 (("/bin/sh") (which "sh")))
217 (invoke "./remake")))
220 (invoke "./remake" "check")))
221 ;; TODO: requires coq-gappa and coq-interval.
222 ;(invoke "./remake" "check-more")
225 (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/37918/gappa-"
244 "1wdg07dk4lbq7dr80ywzna0lclwgi8bddzc6yfx19z1zn9yljzxh"))))
245 (build-system gnu-build-system)
258 (list (string-append "--libdir=" (assoc-ref %outputs "out")
259 "/lib/coq/user-contrib/Gappa")
260 "CXXFLAGS=-std=c++11")
262 (modify-phases %standard-phases
263 (add-before 'configure 'fix-remake
265 (substitute* "remake.cpp"
266 (("/bin/sh") (which "sh")))
269 (lambda _ (invoke "./remake")))
271 (lambda _ (invoke "./remake" "check")))
273 (lambda _ (invoke "./remake" "install"))))))
274 (home-page "http://gappa.gforge.inria.fr/")
275 (synopsis "Verify and formally prove properties on numerical programs")
276 (description "Gappa is a tool intended to help verifying and formally proving
277 properties on numerical programs dealing with floating-point or fixed-point
278 arithmetic. It has been used to write robust floating-point filters for CGAL
279 and it is used to certify elementary functions in CRlibm. While Gappa is
280 intended to be used directly, it can also act as a backend prover for the Why3
281 software verification plateform or as an automatic tactic for the Coq proof
283 (license (list license:gpl2+ license:cecill))));either gpl2+ or cecill
285 (define-public coq-mathcomp
287 (name "coq-mathcomp")
293 (url "https://github.com/math-comp/math-comp.git")
294 (commit (string-append "mathcomp-" version))))
295 (file-name (git-file-name name version))
297 (base32 "1sdrw3b6lc8crz02lp90a863rvyzhc9vcfsrdvc9m311yiaad4xv"))))
298 (build-system gnu-build-system)
304 `(#:tests? #f ; no need to test formally-verified programs :)
306 (modify-phases %standard-phases
308 (add-before 'build 'chdir
309 (lambda _ (chdir "mathcomp") #t))
311 (lambda* (#:key outputs #:allow-other-keys)
312 (setenv "COQLIB" (string-append (assoc-ref outputs "out") "/lib/coq/"))
313 (invoke "make" "-f" "Makefile.coq"
314 (string-append "COQLIB=" (assoc-ref outputs "out")
317 (home-page "https://math-comp.github.io/math-comp/")
318 (synopsis "Mathematical Components for Coq")
319 (description "Mathematical Components for Coq has its origins in the formal
320 proof of the Four Colour Theorem. Since then it has grown to cover many areas
321 of mathematics and has been used for large scale projects like the formal proof
322 of the Odd Order Theorem.
324 The library is written using the Ssreflect proof language that is an integral
325 part of the distribution.")
326 (license license:cecill-b)))
328 (define-public coq-coquelicot
330 (name "coq-coquelicot")
334 (uri (string-append "https://gforge.inria.fr/frs/download.php/"
335 "file/37523/coquelicot-" version ".tar.gz"))
338 "1biia7nfqf7vaqq5gmykl4rwjyvrcwss6r2jdf0in5pvp2rnrj2w"))))
339 (build-system gnu-build-system)
345 `(("mathcomp" ,coq-mathcomp)))
348 (list (string-append "--libdir=" (assoc-ref %outputs "out")
349 "/lib/coq/user-contrib/Coquelicot"))
351 (modify-phases %standard-phases
352 (add-before 'configure 'fix-remake
354 (substitute* "remake.cpp"
355 (("/bin/sh") (which "sh")))
358 (lambda _ (invoke "./remake")))
360 (lambda _ (invoke "./remake" "check")))
362 (lambda _ (invoke "./remake" "install"))))))
363 (home-page "http://coquelicot.saclay.inria.fr/index.html")
364 (synopsis "Coq library for Reals")
365 (description "Coquelicot is an easier way of writing formulas and theorem
366 statements, achieved by relying on total functions in place of dependent types
367 for limits, derivatives, integrals, power series, and so on. To help with the
368 proof process, the library comes with a comprehensive set of theorems that cover
369 not only these notions, but also some extensions such as parametric integrals,
370 two-dimensional differentiability, asymptotic behaviors. It also offers some
371 automations for performing differentiability proofs. Moreover, Coquelicot is a
372 conservative extension of Coq's standard library and provides correspondence
373 theorems between the two libraries.")
374 (license license:lgpl3+)))
376 (define-public coq-bignums
382 (uri (string-append "https://github.com/coq/bignums/archive/V"
384 (file-name (string-append name "-" version ".tar.gz"))
387 "0pmk9smw7a14wrfkvjlvmpxim4bsv6xnm5xkrlld2faqy74a044g"))))
388 (build-system gnu-build-system)
393 `(("camlp5" ,camlp5)))
395 `(#:tests? #f; No test target
397 (list (string-append "COQLIBINSTALL=" (assoc-ref %outputs "out")
398 "/lib/coq/user-contrib"))
400 (modify-phases %standard-phases
401 (delete 'configure))))
402 (home-page "https://github.com/coq/bignums")
403 (synopsis "Coq library for arbitrary large numbers")
404 (description "Bignums is a coq library of arbitrary large numbers. It
405 provides BigN, BigZ, BigQ that used to be part of Coq standard library.")
406 (license license:lgpl2.1+)))
408 (define-public coq-interval
410 (name "coq-interval")
414 (uri (string-append "https://gforge.inria.fr/frs/download.php/"
415 "file/37524/interval-" version ".tar.gz"))
418 "023j9sd64brqvjdidqkn5m8d7a93zd9r86ggh573z9nkjm2m7vvg"))))
419 (build-system gnu-build-system)
425 `(("flocq" ,coq-flocq)
426 ("bignums" ,coq-bignums)
427 ("coquelicot" ,coq-coquelicot)
428 ("mathcomp" ,coq-mathcomp)))
431 (list (string-append "--libdir=" (assoc-ref %outputs "out")
432 "/lib/coq/user-contrib/Gappa"))
434 (modify-phases %standard-phases
435 (add-before 'configure 'fix-remake
437 (substitute* "remake.cpp"
438 (("/bin/sh") (which "sh")))
441 (lambda _ (invoke "./remake")))
443 (lambda _ (invoke "./remake" "check")))
445 (lambda _ (invoke "./remake" "install"))))))
446 (home-page "http://coq-interval.gforge.inria.fr/")
447 (synopsis "Coq tactics to simplify inequality proofs")
448 (description "Interval provides vernacular files containing tactics for
449 simplifying the proofs of inequalities on expressions of real numbers for the
450 Coq proof assistant.")
451 (license license:cecill-c)))
453 (define-public coq-autosubst
454 ;; Latest commit on that branch, where work on supporting coq 8.6 and
455 ;; more recent versions of coq happen.
456 (let ((branch "coq86-devel")
457 (commit "fa6ef30664511ffa659cbcf3c962715cbee03572"))
459 (name "coq-autosubst")
460 (version (git-version "1" branch commit))
464 (url "git://github.com/uds-psl/autosubst.git")
466 (file-name (git-file-name name version))
468 (base32 "1cl0bp96bk6lplbl7n5c703vd3gvbs5mvf2qrf8q333kkqd7jqq4"))))
469 (build-system gnu-build-system)
473 (modify-phases %standard-phases
476 (lambda* (#:key outputs #:allow-other-keys)
477 (setenv "COQLIB" (string-append (assoc-ref outputs "out") "/lib/coq/"))
479 (string-append "COQLIB=" (assoc-ref outputs "out")
484 (home-page "https://www.ps.uni-saarland.de/autosubst/")
485 (synopsis "Coq library for parallel de Bruijn substitutions")
486 (description "Formalizing syntactic theories with variable binders is
487 not easy. Autosubst is a library for the Coq proof assistant to
488 automate this process. Given an inductive definition of syntactic objects in
489 de Bruijn representation augmented with binding annotations, Autosubst
490 synthesizes the parallel substitution operation and automatically proves the
491 basic lemmas about substitutions. This library contains an automation
492 tactic that solves equations involving terms and substitutions. This makes the
493 usage of substitution lemmas unnecessary. The tactic is based on our current
494 work on a decision procedure for the equational theory of an extension of the
495 sigma-calculus by Abadi et al. The library is completely written in Coq and
496 uses Ltac to synthesize the substitution operation.")
497 (license license:bsd-3))))
499 (define-public coq-equations
501 (name "coq-equations")
502 (version "1.2-beta2")
506 (url "https://github.com/mattam82/Coq-Equations.git")
507 (commit (string-append "v" version "-8.9"))))
508 (file-name (git-file-name name version))
511 "0y2zwv7jxs1crprj5qvg46h0v9wyfn99ln40yskq91y9h1lj5h3j"))))
512 (build-system gnu-build-system)
518 `(#:test-target "test-suite"
520 (modify-phases %standard-phases
522 (lambda* (#:key outputs #:allow-other-keys)
523 (invoke "coq_makefile" "-f" "_CoqProject" "-o" "Makefile")))
525 (lambda* (#:key outputs #:allow-other-keys)
526 (setenv "COQLIB" (string-append (assoc-ref outputs "out") "/lib/coq/"))
528 (string-append "COQLIB=" (assoc-ref outputs "out")
531 (home-page "https://mattam82.github.io/Coq-Equations/")
532 (synopsis "Function definition plugin for Coq")
533 (description "Equations provides a notation for writing programs
534 by dependent pattern-matching and (well-founded) recursion in Coq. It
535 compiles everything down to eliminators for inductive types, equality
536 and accessibility, providing a definitional extension to the Coq
538 (license license:lgpl2.1)))
540 (define-public coq-stdpp
544 (synopsis "Alternative Coq standard library std++")
548 (url "https://gitlab.mpi-sws.org/iris/stdpp.git")
549 (commit (string-append "coq-stdpp-" version))))
550 (file-name (git-file-name name version))
552 (base32 "11m7kqxsbxygk41v2wsi3npdzwin9fcnzc1gn0gq0rd57wnqk83i"))))
553 (build-system gnu-build-system)
557 `(#:tests? #f ;; the tests are being run automaticlly as part of `make all`
559 (modify-phases %standard-phases
562 (lambda* (#:key outputs #:allow-other-keys)
563 (setenv "COQLIB" (string-append (assoc-ref outputs "out") "/lib/coq/"))
565 (string-append "COQLIB=" (assoc-ref outputs "out")
568 (description "This project contains an extended \"Standard Library\" for
569 Coq called coq-std++. The key features are:
571 @item Great number of definitions and lemmas for common data structures such
572 as lists, finite maps, finite sets, and finite multisets.
574 @item Type classes for common notations (like ∅, ∪, and Haskell-style monad
575 notations) so that these can be overloaded for different data structures.
577 @item It uses type classes to keep track of common properties of types, like
578 it having decidable equality or being countable or finite.
580 @item Most data structures are represented in canonical ways so that Leibniz
581 equality can be used as much as possible (for example, for maps we have m1 =
582 m2 iff ∀ i, m1 !! i = m2 !! i). On top of that, the library provides setoid
583 instances for most types and operations.
585 @item Various tactics for common tasks, like an ssreflect inspired done tactic
586 for finishing trivial goals, a simple breadth-first solver naive_solver, an
587 equality simplifier simplify_eq, a solver solve_proper for proving
588 compatibility of functions with respect to relations, and a solver set_solver
589 for goals involving set operations.
591 @item The library is dependency- and axiom-free.
593 (home-page "https://gitlab.mpi-sws.org/iris/stdpp")
594 (license license:bsd-3)))