gnu: leveldb: Update home page.
[jackhill/guix/guix.git] / gnu / packages / coq.scm
... / ...
CommitLineData
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;;;
6;;; This file is part of GNU Guix.
7;;;
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.
12;;;
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.
17;;;
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/>.
20
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)))
42
43(define-public coq
44 (package
45 (name "coq")
46 (version "8.9.1")
47 (source
48 (origin
49 (method git-fetch)
50 (uri (git-reference
51 (url "https://github.com/coq/coq.git")
52 (commit (string-append "V" version))))
53 (file-name (git-file-name name version))
54 (sha256
55 (base32 "1p4z967s18wkblayv12ygqsrqlyk5ax1pz40yf4kag8pva6gblhk"))))
56 (native-search-paths
57 (list (search-path-specification
58 (variable "COQPATH")
59 (files (list "lib/coq/user-contrib")))))
60 (build-system ocaml-build-system)
61 (inputs
62 `(("lablgtk" ,lablgtk)
63 ("python" ,python-2)
64 ("camlp5" ,camlp5)
65 ("ocaml-num" ,ocaml-num)))
66 (native-inputs
67 `(("ocaml-ounit" ,ocaml-ounit)))
68 (arguments
69 `(#:phases
70 (modify-phases %standard-phases
71 (add-after 'unpack 'make-git-checkout-writable
72 (lambda _
73 (for-each make-file-writable (find-files "."))
74 #t))
75 (replace 'configure
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)\""))
80 (invoke "./configure"
81 "-prefix" out
82 "-mandir" mandir
83 "-browser" browser
84 "-coqide" "opt"))))
85 (replace 'build
86 (lambda _
87 (invoke "make"
88 "-j" (number->string (parallel-job-count))
89 "world")))
90 (delete 'check)
91 (add-after 'install 'check
92 (lambda _
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")
99 (invoke "make")))))))
100 (home-page "https://coq.inria.fr")
101 (synopsis "Proof assistant for higher-order logic")
102 (description
103 "Coq is a proof assistant for higher-order logic, which allows the
104development of computer programs consistent with their formal specification.
105It 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+))))
109
110(define-public proof-general
111 (package
112 (name "proof-general")
113 (version "4.2")
114 (source (origin
115 (method url-fetch)
116 (uri (string-append
117 "http://proofgeneral.inf.ed.ac.uk/releases/"
118 "ProofGeneral-" version ".tgz"))
119 (sha256
120 (base32
121 "09qb0myq66fw17v4ziz401ilsb5xlxz1nl2wsp69d0vrfy0bcrrm"))))
122 (build-system gnu-build-system)
123 (native-inputs
124 `(("which" ,which)
125 ("emacs" ,emacs-minimal)
126 ("texinfo" ,texinfo)))
127 (inputs
128 `(("host-emacs" ,emacs)
129 ("perl" ,perl)
130 ("coq" ,coq)))
131 (arguments
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)
136 (guix build utils)
137 (guix build emacs-utils))
138 #:imported-modules (,@%gnu-build-system-modules
139 (guix build emacs-utils))
140 #:phases
141 (modify-phases %standard-phases
142 (delete 'configure)
143 (add-after 'unpack 'disable-byte-compile-error-on-warn
144 (lambda _
145 (substitute* "Makefile"
146 (("\\(setq byte-compile-error-on-warn t\\)")
147 "(setq byte-compile-error-on-warn nil)"))
148 #t))
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)
164 (string-append all
165 "PGHOME=$PGHOMEDEFAULT\n"
166 "EMACS=" emacs "/bin/emacs")))
167 #t)))
168 (add-after 'unpack 'clean
169 (lambda _
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")
181 (description
182 "Proof General is a major mode to turn Emacs into an interactive proof
183assistant to write formal mathematical proofs using a variety of theorem
184provers.")
185 (license license:gpl2+)))
186
187(define-public coq-flocq
188 (package
189 (name "coq-flocq")
190 (version "3.1.0")
191 (source (origin
192 (method url-fetch)
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"))
196 (sha256
197 (base32
198 "02szrgz9m0ac51la1lqpiv6i2g0zbgx9gz5rp0q1g00ajldyna5c"))))
199 (build-system gnu-build-system)
200 (native-inputs
201 `(("ocaml" ,ocaml)
202 ("which" ,which)
203 ("coq" ,coq)))
204 (arguments
205 `(#:configure-flags
206 (list (string-append "--libdir=" (assoc-ref %outputs "out")
207 "/lib/coq/user-contrib/Flocq"))
208 #:phases
209 (modify-phases %standard-phases
210 (add-before 'configure 'fix-remake
211 (lambda _
212 (substitute* "remake.cpp"
213 (("/bin/sh") (which "sh")))
214 #t))
215 (replace 'build
216 (lambda _
217 (invoke "./remake")))
218 (replace 'check
219 (lambda _
220 (invoke "./remake" "check")))
221 ;; TODO: requires coq-gappa and coq-interval.
222 ;(invoke "./remake" "check-more")
223 (replace 'install
224 (lambda _
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
229the Coq system. It provides a comprehensive library of theorems on a multi-radix
230multi-precision arithmetic. It also supports efficient numerical computations
231inside Coq.")
232 (license license:lgpl3+)))
233
234(define-public coq-gappa
235 (package
236 (name "coq-gappa")
237 (version "1.3.4")
238 (source (origin
239 (method url-fetch)
240 (uri (string-append "https://gforge.inria.fr/frs/download.php/file/37918/gappa-"
241 version ".tar.gz"))
242 (sha256
243 (base32
244 "1wdg07dk4lbq7dr80ywzna0lclwgi8bddzc6yfx19z1zn9yljzxh"))))
245 (build-system gnu-build-system)
246 (native-inputs
247 `(("ocaml" ,ocaml)
248 ("which" ,which)
249 ("coq" ,coq)
250 ("bison" ,bison)
251 ("flex" ,flex)))
252 (inputs
253 `(("gmp" ,gmp)
254 ("mpfr" ,mpfr)
255 ("boost" ,boost)))
256 (arguments
257 `(#:configure-flags
258 (list (string-append "--libdir=" (assoc-ref %outputs "out")
259 "/lib/coq/user-contrib/Gappa"))
260 #:phases
261 (modify-phases %standard-phases
262 (add-before 'configure 'fix-remake
263 (lambda _
264 (substitute* "remake.cpp"
265 (("/bin/sh") (which "sh")))
266 #t))
267 (replace 'build
268 (lambda _ (invoke "./remake")))
269 (replace 'check
270 (lambda _ (invoke "./remake" "check")))
271 (replace 'install
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
276properties on numerical programs dealing with floating-point or fixed-point
277arithmetic. It has been used to write robust floating-point filters for CGAL
278and it is used to certify elementary functions in CRlibm. While Gappa is
279intended to be used directly, it can also act as a backend prover for the Why3
280software verification plateform or as an automatic tactic for the Coq proof
281assistant.")
282 (license (list license:gpl2+ license:cecill))));either gpl2+ or cecill
283
284(define-public coq-mathcomp
285 (package
286 (name "coq-mathcomp")
287 (version "1.8.0")
288 (source
289 (origin
290 (method git-fetch)
291 (uri (git-reference
292 (url "https://github.com/math-comp/math-comp.git")
293 (commit (string-append "mathcomp-" version))))
294 (file-name (git-file-name name version))
295 (sha256
296 (base32 "1sdrw3b6lc8crz02lp90a863rvyzhc9vcfsrdvc9m311yiaad4xv"))))
297 (build-system gnu-build-system)
298 (native-inputs
299 `(("ocaml" ,ocaml)
300 ("which" ,which)
301 ("coq" ,coq)))
302 (arguments
303 `(#:tests? #f ; no need to test formally-verified programs :)
304 #:phases
305 (modify-phases %standard-phases
306 (delete 'configure)
307 (add-before 'build 'chdir
308 (lambda _ (chdir "mathcomp") #t))
309 (replace 'install
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")
314 "/lib/coq/")
315 "install"))))))
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
319proof of the Four Colour Theorem. Since then it has grown to cover many areas
320of mathematics and has been used for large scale projects like the formal proof
321of the Odd Order Theorem.
322
323The library is written using the Ssreflect proof language that is an integral
324part of the distribution.")
325 (license license:cecill-b)))
326
327(define-public coq-coquelicot
328 (package
329 (name "coq-coquelicot")
330 (version "3.0.2")
331 (source (origin
332 (method url-fetch)
333 (uri (string-append "https://gforge.inria.fr/frs/download.php/"
334 "file/37523/coquelicot-" version ".tar.gz"))
335 (sha256
336 (base32
337 "1biia7nfqf7vaqq5gmykl4rwjyvrcwss6r2jdf0in5pvp2rnrj2w"))))
338 (build-system gnu-build-system)
339 (native-inputs
340 `(("ocaml" ,ocaml)
341 ("which" ,which)
342 ("coq" ,coq)))
343 (propagated-inputs
344 `(("mathcomp" ,coq-mathcomp)))
345 (arguments
346 `(#:configure-flags
347 (list (string-append "--libdir=" (assoc-ref %outputs "out")
348 "/lib/coq/user-contrib/Coquelicot"))
349 #:phases
350 (modify-phases %standard-phases
351 (add-before 'configure 'fix-remake
352 (lambda _
353 (substitute* "remake.cpp"
354 (("/bin/sh") (which "sh")))
355 #t))
356 (replace 'build
357 (lambda _ (invoke "./remake")))
358 (replace 'check
359 (lambda _ (invoke "./remake" "check")))
360 (replace 'install
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
365statements, achieved by relying on total functions in place of dependent types
366for limits, derivatives, integrals, power series, and so on. To help with the
367proof process, the library comes with a comprehensive set of theorems that cover
368not only these notions, but also some extensions such as parametric integrals,
369two-dimensional differentiability, asymptotic behaviors. It also offers some
370automations for performing differentiability proofs. Moreover, Coquelicot is a
371conservative extension of Coq's standard library and provides correspondence
372theorems between the two libraries.")
373 (license license:lgpl3+)))
374
375(define-public coq-bignums
376 (package
377 (name "coq-bignums")
378 (version "8.9.0")
379 (source (origin
380 (method url-fetch)
381 (uri (string-append "https://github.com/coq/bignums/archive/V"
382 version ".tar.gz"))
383 (file-name (string-append name "-" version ".tar.gz"))
384 (sha256
385 (base32
386 "0pmk9smw7a14wrfkvjlvmpxim4bsv6xnm5xkrlld2faqy74a044g"))))
387 (build-system gnu-build-system)
388 (native-inputs
389 `(("ocaml" ,ocaml)
390 ("coq" ,coq)))
391 (inputs
392 `(("camlp5" ,camlp5)))
393 (arguments
394 `(#:tests? #f; No test target
395 #:make-flags
396 (list (string-append "COQLIBINSTALL=" (assoc-ref %outputs "out")
397 "/lib/coq/user-contrib"))
398 #:phases
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
404provides BigN, BigZ, BigQ that used to be part of Coq standard library.")
405 (license license:lgpl2.1+)))
406
407(define-public coq-interval
408 (package
409 (name "coq-interval")
410 (version "3.4.0")
411 (source (origin
412 (method url-fetch)
413 (uri (string-append "https://gforge.inria.fr/frs/download.php/"
414 "file/37524/interval-" version ".tar.gz"))
415 (sha256
416 (base32
417 "023j9sd64brqvjdidqkn5m8d7a93zd9r86ggh573z9nkjm2m7vvg"))))
418 (build-system gnu-build-system)
419 (native-inputs
420 `(("ocaml" ,ocaml)
421 ("which" ,which)
422 ("coq" ,coq)))
423 (propagated-inputs
424 `(("flocq" ,coq-flocq)
425 ("bignums" ,coq-bignums)
426 ("coquelicot" ,coq-coquelicot)
427 ("mathcomp" ,coq-mathcomp)))
428 (arguments
429 `(#:configure-flags
430 (list (string-append "--libdir=" (assoc-ref %outputs "out")
431 "/lib/coq/user-contrib/Gappa"))
432 #:phases
433 (modify-phases %standard-phases
434 (add-before 'configure 'fix-remake
435 (lambda _
436 (substitute* "remake.cpp"
437 (("/bin/sh") (which "sh")))
438 #t))
439 (replace 'build
440 (lambda _ (invoke "./remake")))
441 (replace 'check
442 (lambda _ (invoke "./remake" "check")))
443 (replace 'install
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
448simplifying the proofs of inequalities on expressions of real numbers for the
449Coq proof assistant.")
450 (license license:cecill-c)))
451
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 "fa6ef30664511ffa659cbcf3c962715cbee03572"))
457 (package
458 (name "coq-autosubst")
459 (version (git-version "1" branch commit))
460 (source (origin
461 (method git-fetch)
462 (uri (git-reference
463 (url "git://github.com/uds-psl/autosubst.git")
464 (commit commit)))
465 (file-name (git-file-name name version))
466 (sha256
467 (base32 "1cl0bp96bk6lplbl7n5c703vd3gvbs5mvf2qrf8q333kkqd7jqq4"))))
468 (build-system gnu-build-system)
469 (arguments
470 `(#:tests? #f
471 #:phases
472 (modify-phases %standard-phases
473 (delete 'configure)
474 (replace 'install
475 (lambda* (#:key outputs #:allow-other-keys)
476 (setenv "COQLIB" (string-append (assoc-ref outputs "out") "/lib/coq/"))
477 (invoke "make"
478 (string-append "COQLIB=" (assoc-ref outputs "out")
479 "/lib/coq/")
480 "install"))))))
481 (native-inputs
482 `(("coq" ,coq)))
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
486not easy. Autosubst is a library for the Coq proof assistant to
487automate this process. Given an inductive definition of syntactic objects in
488de Bruijn representation augmented with binding annotations, Autosubst
489synthesizes the parallel substitution operation and automatically proves the
490basic lemmas about substitutions. This library contains an automation
491tactic that solves equations involving terms and substitutions. This makes the
492usage of substitution lemmas unnecessary. The tactic is based on our current
493work on a decision procedure for the equational theory of an extension of the
494sigma-calculus by Abadi et al. The library is completely written in Coq and
495uses Ltac to synthesize the substitution operation.")
496 (license license:bsd-3))))
497
498(define-public coq-equations
499 (package
500 (name "coq-equations")
501 (version "1.2")
502 (source (origin
503 (method git-fetch)
504 (uri (git-reference
505 (url "https://github.com/mattam82/Coq-Equations.git")
506 (commit (string-append "v" version "-8.9"))))
507 (file-name (git-file-name name version))
508 (sha256
509 (base32
510 "1q3wvicr43bgy7xn1diwh4j43mnrhprrc2xd22qlbz9cl6bhf8bj"))))
511 (build-system gnu-build-system)
512 (native-inputs
513 `(("ocaml" ,ocaml)
514 ("coq" ,coq)
515 ("camlp5" ,camlp5)))
516 (arguments
517 `(#:test-target "test-suite"
518 #:phases
519 (modify-phases %standard-phases
520 (replace 'configure
521 (lambda* (#:key outputs #:allow-other-keys)
522 (invoke "coq_makefile" "-f" "_CoqProject" "-o" "Makefile")))
523 (replace 'install
524 (lambda* (#:key outputs #:allow-other-keys)
525 (setenv "COQLIB" (string-append (assoc-ref outputs "out") "/lib/coq/"))
526 (invoke "make"
527 (string-append "COQLIB=" (assoc-ref outputs "out")
528 "/lib/coq/")
529 "install"))))))
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
533by dependent pattern-matching and (well-founded) recursion in Coq. It
534compiles everything down to eliminators for inductive types, equality
535and accessibility, providing a definitional extension to the Coq
536kernel.")
537 (license license:lgpl2.1)))
538
539(define-public coq-stdpp
540 (package
541 (name "coq-stdpp")
542 (version "1.2.0")
543 (synopsis "Alternative Coq standard library std++")
544 (source (origin
545 (method git-fetch)
546 (uri (git-reference
547 (url "https://gitlab.mpi-sws.org/iris/stdpp.git")
548 (commit (string-append "coq-stdpp-" version))))
549 (file-name (git-file-name name version))
550 (sha256
551 (base32 "11m7kqxsbxygk41v2wsi3npdzwin9fcnzc1gn0gq0rd57wnqk83i"))))
552 (build-system gnu-build-system)
553 (inputs
554 `(("coq" ,coq)))
555 (arguments
556 `(#:tests? #f ;; the tests are being run automaticlly as part of `make all`
557 #:phases
558 (modify-phases %standard-phases
559 (delete 'configure)
560 (replace 'install
561 (lambda* (#:key outputs #:allow-other-keys)
562 (setenv "COQLIB" (string-append (assoc-ref outputs "out") "/lib/coq/"))
563 (invoke "make"
564 (string-append "COQLIB=" (assoc-ref outputs "out")
565 "/lib/coq/")
566 "install"))))))
567 (description "This project contains an extended \"Standard Library\" for
568Coq called coq-std++. The key features are:
569@itemize
570@item Great number of definitions and lemmas for common data structures such
571as lists, finite maps, finite sets, and finite multisets.
572
573@item Type classes for common notations (like ∅, ∪, and Haskell-style monad
574notations) so that these can be overloaded for different data structures.
575
576@item It uses type classes to keep track of common properties of types, like
577it having decidable equality or being countable or finite.
578
579@item Most data structures are represented in canonical ways so that Leibniz
580equality can be used as much as possible (for example, for maps we have m1 =
581m2 iff ∀ i, m1 !! i = m2 !! i). On top of that, the library provides setoid
582instances for most types and operations.
583
584@item Various tactics for common tasks, like an ssreflect inspired done tactic
585for finishing trivial goals, a simple breadth-first solver naive_solver, an
586equality simplifier simplify_eq, a solver solve_proper for proving
587compatibility of functions with respect to relations, and a solver set_solver
588for goals involving set operations.
589
590@item The library is dependency- and axiom-free.
591@end itemize")
592 (home-page "https://gitlab.mpi-sws.org/iris/stdpp")
593 (license license:bsd-3)))