1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2018 Julien Lepiller <julien@lepiller.eu>
3 ;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
4 ;;; Copyright © 2019 Dan Frumin <dfrumin@cs.ru.nl>
5 ;;; Copyright © 2020 Brett Gilio <brettg@gnu.org>
6 ;;; Copyright © 2020 Björn Höfling <bjoern.hoefling@bjoernhoefling.de>
8 ;;; This file is part of GNU Guix.
10 ;;; GNU Guix is free software; you can redistribute it and/or modify it
11 ;;; under the terms of the GNU General Public License as published by
12 ;;; the Free Software Foundation; either version 3 of the License, or (at
13 ;;; your option) any later version.
15 ;;; GNU Guix is distributed in the hope that it will be useful, but
16 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;;; GNU General Public License for more details.
20 ;;; You should have received a copy of the GNU General Public License
21 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
23 (define-module (gnu packages coq)
24 #:use-module (gnu packages)
25 #:use-module (gnu packages autotools)
26 #:use-module (gnu packages base)
27 #:use-module (gnu packages bison)
28 #:use-module (gnu packages boost)
29 #:use-module (gnu packages emacs)
30 #:use-module (gnu packages flex)
31 #:use-module (gnu packages gawk)
32 #:use-module (gnu packages multiprecision)
33 #:use-module (gnu packages ocaml)
34 #:use-module (gnu packages perl)
35 #:use-module (gnu packages python)
36 #:use-module (gnu packages texinfo)
37 #:use-module (guix build-system gnu)
38 #:use-module (guix build-system ocaml)
39 #:use-module (guix download)
40 #:use-module (guix git-download)
41 #:use-module ((guix licenses) #:prefix license:)
42 #:use-module (guix packages)
43 #:use-module (guix utils)
44 #:use-module ((srfi srfi-1) #:hide (zip)))
54 (url "https://github.com/coq/coq.git")
55 (commit (string-append "V" version))))
56 (file-name (git-file-name name version))
59 "0ji2rzd70b3hcwfw97qk7rv3m2977ylqnq82l1555dp3njr8nm3q"))))
61 (list (search-path-specification
63 (files (list "lib/coq/user-contrib")))))
64 (build-system ocaml-build-system)
65 (outputs '("out" "ide"))
67 `(("lablgtk" ,lablgtk3)
70 ("ocaml-num" ,ocaml-num)))
72 `(("ocaml-ounit" ,ocaml-ounit)))
75 (modify-phases %standard-phases
76 (add-after 'unpack 'make-git-checkout-writable
78 (for-each make-file-writable (find-files "."))
81 (lambda* (#:key outputs #:allow-other-keys)
82 (let* ((out (assoc-ref outputs "out"))
83 (mandir (string-append out "/share/man"))
84 (browser "icecat -remote \"OpenURL(%s,new-tab)\""))
93 "-j" (number->string (parallel-job-count))
96 (add-after 'install 'remove-duplicate
97 (lambda* (#:key outputs #:allow-other-keys)
98 (let* ((out (assoc-ref outputs "out"))
99 (bin (string-append out "/bin")))
100 ;; These files are exact copies without `.opt` extension.
101 ;; Removing these saves 35 MiB in the resulting package.
102 (delete-file (string-append bin "/coqtop.opt"))
103 (delete-file (string-append bin "/coqidetop.opt")))
105 (add-after 'install 'install-ide
106 (lambda* (#:key outputs #:allow-other-keys)
107 (let ((out (assoc-ref outputs "out"))
108 (ide (assoc-ref outputs "ide")))
109 (mkdir-p (string-append ide "/bin"))
110 (rename-file (string-append out "/bin/coqide")
111 (string-append ide "/bin/coqide")))
113 (add-after 'install 'check
115 (with-directory-excursion "test-suite"
116 ;; These two tests fail.
117 ;; Fails because the output is not formatted as expected.
118 (delete-file-recursively "coq-makefile/timing")
119 ;; Fails because we didn't build coqtop.byte.
120 (delete-file-recursively "coq-makefile/findlib-package")
121 (invoke "make")))))))
122 (home-page "https://coq.inria.fr")
123 (synopsis "Proof assistant for higher-order logic")
125 "Coq is a proof assistant for higher-order logic, which allows the
126 development of computer programs consistent with their formal specification.
127 It is developed using Objective Caml and Camlp5.")
128 ;; The source code is distributed under lgpl2.1.
129 ;; Some of the documentation is distributed under opl1.0+.
130 (license (list license:lgpl2.1 license:opl1.0+))))
132 (define-public proof-general
134 (name "proof-general")
139 "http://proofgeneral.inf.ed.ac.uk/releases/"
140 "ProofGeneral-" version ".tgz"))
143 "09qb0myq66fw17v4ziz401ilsb5xlxz1nl2wsp69d0vrfy0bcrrm"))))
144 (build-system gnu-build-system)
147 ("emacs" ,emacs-minimal)
148 ("texinfo" ,texinfo)))
150 `(("host-emacs" ,emacs)
154 `(#:tests? #f ; no check target
155 #:make-flags (list (string-append "PREFIX=" %output)
156 (string-append "DEST_PREFIX=" %output))
157 #:modules ((guix build gnu-build-system)
159 (guix build emacs-utils))
160 #:imported-modules (,@%gnu-build-system-modules
161 (guix build emacs-utils))
163 (modify-phases %standard-phases
165 (add-after 'unpack 'disable-byte-compile-error-on-warn
167 (substitute* "Makefile"
168 (("\\(setq byte-compile-error-on-warn t\\)")
169 "(setq byte-compile-error-on-warn nil)"))
171 (add-after 'unpack 'patch-hardcoded-paths
172 (lambda* (#:key inputs outputs #:allow-other-keys)
173 (let ((out (assoc-ref outputs "out"))
174 (coq (assoc-ref inputs "coq"))
175 (emacs (assoc-ref inputs "host-emacs")))
176 (define (coq-prog name)
177 (string-append coq "/bin/" name))
178 (emacs-substitute-variables "coq/coq.el"
179 ("coq-prog-name" (coq-prog "coqtop"))
180 ("coq-compiler" (coq-prog "coqc"))
181 ("coq-dependency-analyzer" (coq-prog "coqdep")))
182 (substitute* "Makefile"
183 (("/sbin/install-info") "install-info"))
184 (substitute* "bin/proofgeneral"
185 (("^PGHOMEDEFAULT=.*" all)
187 "PGHOME=$PGHOMEDEFAULT\n"
188 "EMACS=" emacs "/bin/emacs")))
190 (add-after 'unpack 'clean
192 ;; Delete the pre-compiled elc files for Emacs 23.
193 (invoke "make" "clean")))
194 (add-after 'install 'install-doc
195 (lambda* (#:key make-flags #:allow-other-keys)
196 ;; XXX FIXME avoid building/installing pdf files,
197 ;; due to unresolved errors building them.
198 (substitute* "Makefile"
199 ((" [^ ]*\\.pdf") ""))
200 (apply invoke "make" "install-doc" make-flags))))))
201 (home-page "http://proofgeneral.inf.ed.ac.uk/")
202 (synopsis "Generic front-end for proof assistants based on Emacs")
204 "Proof General is a major mode to turn Emacs into an interactive proof
205 assistant to write formal mathematical proofs using a variety of theorem
207 (license license:gpl2+)))
209 (define-public coq-flocq
217 (url "https://gitlab.inria.fr/flocq/flocq.git")
218 (commit (string-append "flocq-" version))))
219 (file-name (git-file-name name version))
222 "15bi36x7zj0glsb3s2gwqd4wswhfzh36rbp7imbyff53a7nna95l"))))
223 (build-system gnu-build-system)
225 `(("autoconf" ,autoconf)
226 ("automake" ,automake)
232 (list (string-append "--libdir=" (assoc-ref %outputs "out")
233 "/lib/coq/user-contrib/Flocq"))
235 (modify-phases %standard-phases
236 (add-after 'unpack 'remove-failing-examples
238 (substitute* "Remakefile.in"
239 ;; Fails on a union error.
240 (("Double_rounding_odd_radix.v") ""))
242 (add-before 'configure 'fix-remake
244 (substitute* "remake.cpp"
245 (("/bin/sh") (which "sh")))
249 (invoke "./remake")))
252 (invoke "./remake" "check")))
253 ;; TODO: requires coq-gappa and coq-interval.
254 ;(invoke "./remake" "check-more")
257 (invoke "./remake" "install"))))))
258 (home-page "https://flocq.gforge.inria.fr/")
259 (synopsis "Floating-point formalization for the Coq system")
260 (description "Flocq (Floats for Coq) is a floating-point formalization for
261 the Coq system. It provides a comprehensive library of theorems on a multi-radix
262 multi-precision arithmetic. It also supports efficient numerical computations
264 (license license:lgpl3+)))
266 (define-public coq-gappa
274 (url "https://gitlab.inria.fr/gappa/coq.git")
275 (commit (string-append "gappalib-coq-" version))))
276 (file-name (git-file-name name version))
279 "0r7jwp5xssdfzivs2flp7mzrscqhgl63mryhhf1cvndpgzqwfk2f"))))
280 (build-system gnu-build-system)
282 `(("autoconf" ,autoconf)
283 ("automake" ,automake)
295 `(("coq-flocq" ,coq-flocq)))
298 (list (string-append "--libdir=" (assoc-ref %outputs "out")
299 "/lib/coq/user-contrib/Gappa"))
301 (modify-phases %standard-phases
302 (add-before 'configure 'fix-remake
304 (substitute* "remake.cpp"
305 (("/bin/sh") (which "sh")))
308 (lambda _ (invoke "./remake")))
309 ;; FIXME: Figure out why failures occur, and re-enable check phase.
312 ;; (lambda _ (invoke "./remake" "check")))
314 (lambda _ (invoke "./remake" "install"))))))
315 (home-page "https://gappa.gforge.inria.fr/")
316 (synopsis "Verify and formally prove properties on numerical programs")
317 (description "Gappa is a tool intended to help verifying and formally proving
318 properties on numerical programs dealing with floating-point or fixed-point
319 arithmetic. It has been used to write robust floating-point filters for CGAL
320 and it is used to certify elementary functions in CRlibm. While Gappa is
321 intended to be used directly, it can also act as a backend prover for the Why3
322 software verification plateform or as an automatic tactic for the Coq proof
324 (license (list license:gpl2+ license:cecill))));either gpl2+ or cecill
326 (define-public coq-mathcomp
328 (name "coq-mathcomp")
334 (url "https://github.com/math-comp/math-comp.git")
335 (commit (string-append "mathcomp-" version))))
336 (file-name (git-file-name name version))
338 (base32 "1h5h1c2025r1ms5qryvwy6pikxmpmmjav6yl127xpzmqdi6w732d"))))
339 (build-system gnu-build-system)
345 `(#:tests? #f ; No tests.
347 (modify-phases %standard-phases
349 (add-before 'build 'chdir
350 (lambda _ (chdir "mathcomp") #t))
352 (lambda* (#:key outputs #:allow-other-keys)
353 (invoke "make" "-f" "Makefile.coq"
354 (string-append "COQLIB=" (assoc-ref outputs "out")
357 (home-page "https://math-comp.github.io/")
358 (synopsis "Mathematical Components for Coq")
359 (description "Mathematical Components for Coq has its origins in the formal
360 proof of the Four Colour Theorem. Since then it has grown to cover many areas
361 of mathematics and has been used for large scale projects like the formal proof
362 of the Odd Order Theorem.
364 The library is written using the Ssreflect proof language that is an integral
365 part of the distribution.")
366 (license license:cecill-b)))
368 (define-public coq-coquelicot
370 (name "coq-coquelicot")
376 (url "https://gitlab.inria.fr/coquelicot/coquelicot.git")
377 (commit (string-append "coquelicot-" version))))
378 (file-name (git-file-name name version))
381 "0m5wbr2s8lnf8b7cfwv15hyzsmbcaz6hgdn7aazcrkxnwr87vgkp"))))
382 (build-system gnu-build-system)
384 `(("autoconf" ,autoconf)
385 ("automake" ,automake)
390 `(("mathcomp" ,coq-mathcomp)))
393 (list (string-append "--libdir=" (assoc-ref %outputs "out")
394 "/lib/coq/user-contrib/Coquelicot"))
396 (modify-phases %standard-phases
397 (add-before 'configure 'fix-remake
399 (substitute* "remake.cpp"
400 (("/bin/sh") (which "sh")))
403 (lambda _ (invoke "./remake")))
405 (lambda _ (invoke "./remake" "check")))
407 (lambda _ (invoke "./remake" "install"))))))
408 (home-page "http://coquelicot.saclay.inria.fr")
409 (synopsis "Coq library for Reals")
410 (description "Coquelicot is an easier way of writing formulas and theorem
411 statements, achieved by relying on total functions in place of dependent types
412 for limits, derivatives, integrals, power series, and so on. To help with the
413 proof process, the library comes with a comprehensive set of theorems that cover
414 not only these notions, but also some extensions such as parametric integrals,
415 two-dimensional differentiability, asymptotic behaviors. It also offers some
416 automations for performing differentiability proofs. Moreover, Coquelicot is a
417 conservative extension of Coq's standard library and provides correspondence
418 theorems between the two libraries.")
419 (license license:lgpl3+)))
421 (define-public coq-bignums
428 (url "https://github.com/coq/bignums.git")
429 (commit (string-append "V" version))))
430 (file-name (git-file-name name version))
433 "0bpb4flckn4nqxbs3wjiznyx1k7r8k93qdigp3qwmikp2lxvcbw5"))))
434 (build-system gnu-build-system)
439 `(("camlp5" ,camlp5)))
441 `(#:tests? #f ; No test target.
443 (list (string-append "COQLIBINSTALL=" (assoc-ref %outputs "out")
444 "/lib/coq/user-contrib"))
446 (modify-phases %standard-phases
447 (delete 'configure))))
448 (home-page "https://github.com/coq/bignums")
449 (synopsis "Coq library for arbitrary large numbers")
450 (description "Bignums is a coq library of arbitrary large numbers. It
451 provides BigN, BigZ, BigQ that used to be part of Coq standard library.")
452 (license license:lgpl2.1+)))
454 (define-public coq-interval
456 (name "coq-interval")
462 (url "https://gitlab.inria.fr/coqinterval/interval.git")
463 (commit (string-append "interval-" version))))
464 (file-name (git-file-name name version))
467 "03q3dfqi3r3f7aji5s06ig4aav9ajcwswwdzi5lrgr69z0m487k4"))))
468 (build-system gnu-build-system)
470 `(("autoconf" ,autoconf)
471 ("automake" ,automake)
476 `(("flocq" ,coq-flocq)
477 ("bignums" ,coq-bignums)
478 ("coquelicot" ,coq-coquelicot)
479 ("mathcomp" ,coq-mathcomp)))
482 (list (string-append "--libdir=" (assoc-ref %outputs "out")
483 "/lib/coq/user-contrib/Gappa"))
485 (modify-phases %standard-phases
486 (add-before 'configure 'fix-remake
488 (substitute* "remake.cpp"
489 (("/bin/sh") (which "sh")))
492 (lambda _ (invoke "./remake")))
494 (lambda _ (invoke "./remake" "check")))
496 (lambda _ (invoke "./remake" "install"))))))
497 (home-page "http://coq-interval.gforge.inria.fr/")
498 (synopsis "Coq tactics to simplify inequality proofs")
499 (description "Interval provides vernacular files containing tactics for
500 simplifying the proofs of inequalities on expressions of real numbers for the
501 Coq proof assistant.")
502 (license license:cecill-c)))
504 (define-public coq-autosubst
505 ;; Latest commit on that branch, where work on supporting coq 8.6 and
506 ;; more recent versions of coq happen.
507 (let ((branch "coq86-devel")
508 (commit "fa6ef30664511ffa659cbcf3c962715cbee03572"))
510 (name "coq-autosubst")
511 (version (git-version "1" branch commit))
515 (url "git://github.com/uds-psl/autosubst.git")
517 (file-name (git-file-name name version))
519 (base32 "1cl0bp96bk6lplbl7n5c703vd3gvbs5mvf2qrf8q333kkqd7jqq4"))))
520 (build-system gnu-build-system)
524 (modify-phases %standard-phases
527 (lambda* (#:key outputs #:allow-other-keys)
528 (setenv "COQLIB" (string-append (assoc-ref outputs "out") "/lib/coq/"))
530 (string-append "COQLIB=" (assoc-ref outputs "out")
535 (home-page "https://www.ps.uni-saarland.de/autosubst/")
536 (synopsis "Coq library for parallel de Bruijn substitutions")
537 (description "Formalizing syntactic theories with variable binders is
538 not easy. Autosubst is a library for the Coq proof assistant to
539 automate this process. Given an inductive definition of syntactic objects in
540 de Bruijn representation augmented with binding annotations, Autosubst
541 synthesizes the parallel substitution operation and automatically proves the
542 basic lemmas about substitutions. This library contains an automation
543 tactic that solves equations involving terms and substitutions. This makes the
544 usage of substitution lemmas unnecessary. The tactic is based on our current
545 work on a decision procedure for the equational theory of an extension of the
546 sigma-calculus by Abadi et al. The library is completely written in Coq and
547 uses Ltac to synthesize the substitution operation.")
548 (license license:bsd-3))))
550 (define-public coq-equations
552 (name "coq-equations")
557 (url "https://github.com/mattam82/Coq-Equations.git")
558 (commit (string-append "v" version "-8.10"))))
559 (file-name (git-file-name name version))
562 "023q5dww3drw35dm9bi9p9d0wrj9k7vax7hfdsprf8l340pb4s0k"))))
563 (build-system gnu-build-system)
569 `(#:test-target "test-suite"
571 (modify-phases %standard-phases
573 (lambda* (#:key outputs #:allow-other-keys)
574 (invoke "sh" "./configure.sh")))
576 (lambda* (#:key outputs #:allow-other-keys)
578 (string-append "COQLIB=" (assoc-ref outputs "out")
581 (home-page "https://mattam82.github.io/Coq-Equations/")
582 (synopsis "Function definition plugin for Coq")
583 (description "Equations provides a notation for writing programs
584 by dependent pattern-matching and (well-founded) recursion in Coq. It
585 compiles everything down to eliminators for inductive types, equality
586 and accessibility, providing a definitional extension to the Coq
588 (license license:lgpl2.1)))
590 (define-public coq-stdpp
594 (synopsis "Alternative Coq standard library std++")
598 (url "https://gitlab.mpi-sws.org/iris/stdpp.git")
599 (commit (string-append "coq-stdpp-" version))))
600 (file-name (git-file-name name version))
603 "1lczybg1jq9drbi8nzrlb0k199x4n07aawjwfzrl3qqc0w8kmvdz"))))
604 (build-system gnu-build-system)
608 `(#:tests? #f ; Tests are executed during build phase.
610 (modify-phases %standard-phases
613 (lambda* (#:key outputs #:allow-other-keys)
615 (string-append "COQLIB=" (assoc-ref outputs "out")
618 (description "This project contains an extended \"Standard Library\" for
619 Coq called coq-std++. The key features are:
621 @item Great number of definitions and lemmas for common data structures such
622 as lists, finite maps, finite sets, and finite multisets.
624 @item Type classes for common notations (like ∅, ∪, and Haskell-style monad
625 notations) so that these can be overloaded for different data structures.
627 @item It uses type classes to keep track of common properties of types, like
628 it having decidable equality or being countable or finite.
630 @item Most data structures are represented in canonical ways so that Leibniz
631 equality can be used as much as possible (for example, for maps we have m1 =
632 m2 iff ∀ i, m1 !! i = m2 !! i). On top of that, the library provides setoid
633 instances for most types and operations.
635 @item Various tactics for common tasks, like an ssreflect inspired done tactic
636 for finishing trivial goals, a simple breadth-first solver naive_solver, an
637 equality simplifier simplify_eq, a solver solve_proper for proving
638 compatibility of functions with respect to relations, and a solver set_solver
639 for goals involving set operations.
641 @item The library is dependency- and axiom-free.
643 (home-page "https://gitlab.mpi-sws.org/iris/stdpp")
644 (license license:bsd-3)))