gnu: icecat: Update to 78.10.0-guix0-preview1 [security fixes].
[jackhill/guix/guix.git] / gnu / packages / coq.scm
index e42f8af..fb6a899 100644 (file)
@@ -1,6 +1,11 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2018 Julien Lepiller <julien@lepiller.eu>
+;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2019 Dan Frumin <dfrumin@cs.ru.nl>
+;;; Copyright © 2020 Brett Gilio <brettg@gnu.org>
+;;; Copyright © 2020 Björn Höfling <bjoern.hoefling@bjoernhoefling.de>
+;;; Copyright © 2020 raingloom <raingloom@riseup.net>
+;;; Copyright © 2020 Robin Green <greenrd@greenrd.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
 
 (define-module (gnu packages coq)
   #:use-module (gnu packages)
+  #:use-module (gnu packages autotools)
   #:use-module (gnu packages base)
   #:use-module (gnu packages bison)
   #:use-module (gnu packages boost)
   #:use-module (gnu packages emacs)
   #:use-module (gnu packages flex)
+  #:use-module (gnu packages gawk)
   #:use-module (gnu packages multiprecision)
   #:use-module (gnu packages ocaml)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages rsync)
   #:use-module (gnu packages texinfo)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system ocaml)
 (define-public coq
   (package
     (name "coq")
-    (version "8.8.2")
-    (source (origin
-              (method url-fetch)
-              (uri (string-append "https://github.com/coq/coq/archive/V"
-                                  version ".tar.gz"))
-              (file-name (string-append name "-" version ".tar.gz"))
-              (sha256
-               (base32
-                "0i2hs0i6rp27cy8zd0mx7jscqw5cx2y0diw0pxgij66s3yr47y7r"))))
+    (version "8.11.2")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/coq/coq")
+             (commit (string-append "V" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "1gia82dkmzqspw2w3s4gjyh39ghbmw4i41i4hyzc91g7mza17nbz"))))
     (native-search-paths
      (list (search-path-specification
             (variable "COQPATH")
             (files (list "lib/coq/user-contrib")))))
     (build-system ocaml-build-system)
+    (outputs '("out" "ide"))
     (inputs
-     `(("lablgtk" ,lablgtk)
+     `(("lablgtk" ,lablgtk3)
        ("python" ,python-2)
        ("camlp5" ,camlp5)
        ("ocaml-num" ,ocaml-num)))
+    (native-inputs
+     `(("ocaml-ounit" ,ocaml-ounit)
+       ("rsync" ,rsync)
+       ("which" ,which)))
     (arguments
      `(#:phases
        (modify-phases %standard-phases
+         (add-after 'unpack 'make-git-checkout-writable
+           (lambda _
+             (for-each make-file-writable (find-files "."))
+             #t))
          (replace 'configure
            (lambda* (#:key outputs #:allow-other-keys)
              (let* ((out (assoc-ref outputs "out"))
                      "-j" (number->string (parallel-job-count))
                      "world")))
          (delete 'check)
+         (add-after 'install 'remove-duplicate
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (bin (string-append out "/bin"))
+                    (coqtop (string-append bin "/coqtop"))
+                    (coqidetop (string-append bin "/coqidetop"))
+                    (coqtop.opt (string-append coqtop ".opt"))
+                    (coqidetop.opt (string-append coqidetop ".opt")))
+               ;; These files are exact copies without `.opt` extension.
+               ;; Removing these saves 35 MiB in the resulting package.
+               ;; Unfortunately, completely deleting them breaks coqide.
+               (delete-file coqtop.opt)
+               (delete-file coqidetop.opt)
+               (symlink coqtop coqtop.opt)
+               (symlink coqidetop coqidetop.opt))
+             #t))
+         (add-after 'install 'install-ide
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out"))
+                   (ide (assoc-ref outputs "ide")))
+               (mkdir-p (string-append ide "/bin"))
+               (rename-file (string-append out "/bin/coqide")
+                            (string-append ide "/bin/coqide")))
+             #t))
          (add-after 'install 'check
            (lambda _
              (with-directory-excursion "test-suite"
                ;; These two tests fail.
-               ;; This one fails because the output is not formatted as expected.
+               ;; Fails because the output is not formatted as expected.
                (delete-file-recursively "coq-makefile/timing")
-               ;; This one fails because we didn't build coqtop.byte.
-               (delete-file-recursively "coq-makefile/findlib-package")
+               ;; Fails because we didn't build coqtop.byte.
+               (delete-file "misc/printers.sh")
                (invoke "make")))))))
     (home-page "https://coq.inria.fr")
     (synopsis "Proof assistant for higher-order logic")
      "Coq is a proof assistant for higher-order logic, which allows the
 development of computer programs consistent with their formal specification.
 It is developed using Objective Caml and Camlp5.")
-    ;; The code is distributed under lgpl2.1.
+    ;; The source code is distributed under lgpl2.1.
     ;; Some of the documentation is distributed under opl1.0+.
     (license (list license:lgpl2.1 license:opl1.0+))))
 
 (define-public proof-general
   (package
     (name "proof-general")
-    (version "4.2")
+    (version "4.4")
     (source (origin
-              (method url-fetch)
-              (uri (string-append
-                    "http://proofgeneral.inf.ed.ac.uk/releases/"
-                    "ProofGeneral-" version ".tgz"))
+              (method git-fetch)
+              (uri (git-reference
+                    (url (string-append
+                          "https://github.com/ProofGeneral/PG"))
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
               (sha256
                (base32
-                "09qb0myq66fw17v4ziz401ilsb5xlxz1nl2wsp69d0vrfy0bcrrm"))))
+                "0bdfk91wf71z80mdfnl8hpinripndcjgdkz854zil6521r84nqk8"))))
     (build-system gnu-build-system)
     (native-inputs
      `(("which" ,which)
@@ -144,10 +189,6 @@ It is developed using Objective Caml and Camlp5.")
                             (emacs (assoc-ref inputs "host-emacs")))
                         (define (coq-prog name)
                           (string-append coq "/bin/" name))
-                        (emacs-substitute-variables "coq/coq.el"
-                          ("coq-prog-name"           (coq-prog "coqtop"))
-                          ("coq-compiler"            (coq-prog "coqc"))
-                          ("coq-dependency-analyzer" (coq-prog "coqdep")))
                         (substitute* "Makefile"
                           (("/sbin/install-info") "install-info"))
                         (substitute* "bin/proofgeneral"
@@ -167,7 +208,7 @@ It is developed using Objective Caml and Camlp5.")
              (substitute* "Makefile"
                ((" [^ ]*\\.pdf") ""))
              (apply invoke "make" "install-doc" make-flags))))))
-    (home-page "http://proofgeneral.inf.ed.ac.uk/")
+    (home-page "https://proofgeneral.github.io/ ")
     (synopsis "Generic front-end for proof assistants based on Emacs")
     (description
      "Proof General is a major mode to turn Emacs into an interactive proof
@@ -178,18 +219,22 @@ provers.")
 (define-public coq-flocq
   (package
     (name "coq-flocq")
-    (version "2.6.1")
-    (source (origin
-              (method url-fetch)
-              ;; Use the ‘Latest version’ link for a stable URI across releases.
-              (uri (string-append "https://gforge.inria.fr/frs/download.php/"
-                                  "file/37454/flocq-" version ".tar.gz"))
-              (sha256
-               (base32
-                "06msp1fwpqv6p98a3i1nnkj7ch9rcq3rm916yxq8dxf51lkghrin"))))
+    (version "3.3.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://gitlab.inria.fr/flocq/flocq.git")
+             (commit (string-append "flocq-" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "01gdykva0lcw6y3dm8j0djxayb87szfg9vn0mxd6z3pks644misl"))))
     (build-system gnu-build-system)
     (native-inputs
-     `(("ocaml" ,ocaml)
+     `(("autoconf" ,autoconf)
+       ("automake" ,automake)
+       ("ocaml" ,ocaml)
        ("which" ,which)
        ("coq" ,coq)))
     (arguments
@@ -198,6 +243,12 @@ provers.")
                             "/lib/coq/user-contrib/Flocq"))
        #:phases
        (modify-phases %standard-phases
+         (add-after 'unpack 'remove-failing-examples
+           (lambda _
+             (substitute* "Remakefile.in"
+               ;; Fails on a union error.
+               (("Double_rounding_odd_radix.v") ""))
+             #t))
          (add-before 'configure 'fix-remake
            (lambda _
              (substitute* "remake.cpp"
@@ -205,19 +256,16 @@ provers.")
              #t))
          (replace 'build
            (lambda _
-             (invoke "./remake")
-             #t))
+             (invoke "./remake")))
          (replace 'check
            (lambda _
-             (invoke "./remake" "check")
-             #t))
+             (invoke "./remake" "check")))
              ;; TODO: requires coq-gappa and coq-interval.
              ;(invoke "./remake" "check-more")
          (replace 'install
            (lambda _
-             (invoke "./remake" "install")
-             #t)))))
-    (home-page "http://flocq.gforge.inria.fr/")
+             (invoke "./remake" "install"))))))
+    (home-page "https://flocq.gforge.inria.fr/")
     (synopsis "Floating-point formalization for the Coq system")
     (description "Flocq (Floats for Coq) is a floating-point formalization for
 the Coq system.  It provides a comprehensive library of theorems on a multi-radix
@@ -228,25 +276,33 @@ inside Coq.")
 (define-public coq-gappa
   (package
     (name "coq-gappa")
-    (version "1.3.2")
-    (source (origin
-              (method url-fetch)
-              (uri (string-append "https://gforge.inria.fr/frs/download.php/file/36397/gappa-"
-                                  version ".tar.gz"))
-              (sha256
-               (base32
-                "19kg2zldaqs4smy7bv9hp650sqg46xbx1ss7jnyagpxdscwn9apd"))))
+    (version "1.4.4")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://gitlab.inria.fr/gappa/coq.git")
+             (commit (string-append "gappalib-coq-" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0f3g3wjkvfkm961l4jpckhsqd43jnvm7f5qqk78qc32zh1fg339n"))))
     (build-system gnu-build-system)
     (native-inputs
-     `(("ocaml" ,ocaml)
+     `(("autoconf" ,autoconf)
+       ("automake" ,automake)
+       ("ocaml" ,ocaml)
        ("which" ,which)
        ("coq" ,coq)
+       ("camlp5" ,camlp5)
        ("bison" ,bison)
        ("flex" ,flex)))
     (inputs
      `(("gmp" ,gmp)
        ("mpfr" ,mpfr)
        ("boost" ,boost)))
+    (propagated-inputs
+     `(("coq-flocq" ,coq-flocq)))
     (arguments
      `(#:configure-flags
        (list (string-append "--libdir=" (assoc-ref %outputs "out")
@@ -260,11 +316,13 @@ inside Coq.")
              #t))
          (replace 'build
            (lambda _ (invoke "./remake")))
-         (replace 'check
-           (lambda _ (invoke "./remake" "check")))
+         ;; FIXME: Figure out why failures occur, and re-enable check phase.
+         (delete 'check)
+         ;; (replace 'check
+         ;;   (lambda _ (invoke "./remake" "check")))
          (replace 'install
            (lambda _ (invoke "./remake" "install"))))))
-    (home-page "http://gappa.gforge.inria.fr/")
+    (home-page "https://gappa.gforge.inria.fr/")
     (synopsis "Verify and formally prove properties on numerical programs")
     (description "Gappa is a tool intended to help verifying and formally proving
 properties on numerical programs dealing with floating-point or fixed-point
@@ -278,21 +336,23 @@ assistant.")
 (define-public coq-mathcomp
   (package
     (name "coq-mathcomp")
-    (version "1.7.0")
-    (source (origin
-              (method url-fetch)
-              (uri (string-append "https://github.com/math-comp/math-comp/archive/mathcomp-"
-                                  version ".tar.gz"))
-              (sha256
-               (base32
-                "05zgyi4wmasi1rcyn5jq42w0bi9713q9m8dl1fdgl66nmacixh39"))))
+    (version "1.11.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/math-comp/math-comp")
+             (commit (string-append "mathcomp-" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1axywpa1jcpnidd86irpd1gdbbg2sfbwc652675xisq5wnmfmf6f"))))
     (build-system gnu-build-system)
     (native-inputs
      `(("ocaml" ,ocaml)
        ("which" ,which)
        ("coq" ,coq)))
     (arguments
-     `(#:tests? #f; No need to test formally-verified programs :)
+     `(#:tests? #f ; No tests.
        #:phases
        (modify-phases %standard-phases
          (delete 'configure)
@@ -300,12 +360,11 @@ assistant.")
            (lambda _ (chdir "mathcomp") #t))
          (replace 'install
            (lambda* (#:key outputs #:allow-other-keys)
-             (setenv "COQLIB" (string-append (assoc-ref outputs "out") "/lib/coq/"))
              (invoke "make" "-f" "Makefile.coq"
                      (string-append "COQLIB=" (assoc-ref outputs "out")
                                     "/lib/coq/")
                      "install"))))))
-    (home-page "https://math-comp.github.io/math-comp/")
+    (home-page "https://math-comp.github.io/")
     (synopsis "Mathematical Components for Coq")
     (description "Mathematical Components for Coq has its origins in the formal
 proof of the Four Colour Theorem.  Since then it has grown to cover many areas
@@ -319,17 +378,22 @@ part of the distribution.")
 (define-public coq-coquelicot
   (package
     (name "coq-coquelicot")
-    (version "3.0.1")
-    (source (origin
-              (method url-fetch)
-              (uri (string-append "https://gforge.inria.fr/frs/download.php/"
-                                  "file/37045/coquelicot-" version ".tar.gz"))
-              (sha256
-               (base32
-                "0hsyhsy2lwqxxx2r8xgi5csmirss42lp9bkb9yy35mnya0w78c8r"))))
+    (version "3.1.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://gitlab.inria.fr/coquelicot/coquelicot.git")
+             (commit (string-append "coquelicot-" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0mz3pxan1237fr5fi79c66y7b9z7bmi0sc45kwrmkczsjm5462jm"))))
     (build-system gnu-build-system)
     (native-inputs
-     `(("ocaml" ,ocaml)
+     `(("autoconf" ,autoconf)
+       ("automake" ,automake)
+       ("ocaml" ,ocaml)
        ("which" ,which)
        ("coq" ,coq)))
     (propagated-inputs
@@ -340,12 +404,6 @@ part of the distribution.")
                             "/lib/coq/user-contrib/Coquelicot"))
        #:phases
        (modify-phases %standard-phases
-         (add-before 'configure 'fix-coq8.8
-           (lambda _
-             ; appcontext has been removed from coq 8.8
-             (substitute* "theories/AutoDerive.v"
-               (("appcontext") "context"))
-             #t))
          (add-before 'configure 'fix-remake
            (lambda _
              (substitute* "remake.cpp"
@@ -357,7 +415,7 @@ part of the distribution.")
            (lambda _ (invoke "./remake" "check")))
          (replace 'install
            (lambda _ (invoke "./remake" "install"))))))
-    (home-page "http://coquelicot.saclay.inria.fr/index.html")
+    (home-page "http://coquelicot.saclay.inria.fr")
     (synopsis "Coq library for Reals")
     (description "Coquelicot is an easier way of writing formulas and theorem
 statements, achieved by relying on total functions in place of dependent types
@@ -373,15 +431,16 @@ theorems between the two libraries.")
 (define-public coq-bignums
   (package
     (name "coq-bignums")
-    (version "8.8.0")
+    (version "8.11.0")
     (source (origin
-              (method url-fetch)
-              (uri (string-append "https://github.com/coq/bignums/archive/V"
-                                  version ".tar.gz"))
-              (file-name (string-append name "-" version ".tar.gz"))
+              (method git-fetch)
+              (uri (git-reference
+                     (url "https://github.com/coq/bignums")
+                     (commit (string-append "V" version))))
+              (file-name (git-file-name name version))
               (sha256
                (base32
-                "08m1cmq4hkaf4sb0vy978c11rgzvds71cphyadmr2iirpr5815r0"))))
+                "1xcd7c7qlvs0narfba6px34zq0mz8rffnhxw0kzhhg6i4iw115dp"))))
     (build-system gnu-build-system)
     (native-inputs
      `(("ocaml" ,ocaml)
@@ -389,7 +448,7 @@ theorems between the two libraries.")
     (inputs
      `(("camlp5" ,camlp5)))
     (arguments
-     `(#:tests? #f; No test target
+     `(#:tests? #f ; No test target.
        #:make-flags
        (list (string-append "COQLIBINSTALL=" (assoc-ref %outputs "out")
                             "/lib/coq/user-contrib"))
@@ -405,17 +464,22 @@ provides BigN, BigZ, BigQ that used to be part of Coq standard library.")
 (define-public coq-interval
   (package
     (name "coq-interval")
-    (version "3.3.0")
-    (source (origin
-              (method url-fetch)
-              (uri (string-append "https://gforge.inria.fr/frs/download.php/"
-                                  "file/37077/interval-" version ".tar.gz"))
-              (sha256
-               (base32
-                "08fdcf3hbwqphglvwprvqzgkg0qbimpyhnqsgv3gac4y1ap0f903"))))
+    (version "4.0.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://gitlab.inria.fr/coqinterval/interval.git")
+             (commit (string-append "interval-" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "01iz6qmnsm6b9s1vmdjs79vjx9xgwzn5rwyjp6bvs8hg3zlmhpip"))))
     (build-system gnu-build-system)
     (native-inputs
-     `(("ocaml" ,ocaml)
+     `(("autoconf" ,autoconf)
+       ("automake" ,automake)
+       ("ocaml" ,ocaml)
        ("which" ,which)
        ("coq" ,coq)))
     (propagated-inputs
@@ -451,18 +515,18 @@ Coq proof assistant.")
   ;; Latest commit on that branch, where work on supporting coq 8.6 and
   ;; more recent versions of coq happen.
   (let ((branch "coq86-devel")
-        (commit "d0d73557979796b3d4be7aac72135581c33f26f7"))
+        (commit "fa6ef30664511ffa659cbcf3c962715cbee03572"))
     (package
       (name "coq-autosubst")
       (version (git-version "1" branch commit))
       (source (origin
                 (method git-fetch)
                 (uri (git-reference
-                      (url "git://github.com/uds-psl/autosubst.git")
+                      (url "git://github.com/uds-psl/autosubst")
                       (commit commit)))
                 (file-name (git-file-name name version))
                 (sha256
-                 (base32 "1852xb5cwkjw3dlc0lp2sakwa40bjzw37qmwz4bn3vqazg1hnh6r"))))
+                 (base32 "1cl0bp96bk6lplbl7n5c703vd3gvbs5mvf2qrf8q333kkqd7jqq4"))))
       (build-system gnu-build-system)
       (arguments
        `(#:tests? #f
@@ -492,3 +556,99 @@ work on a decision procedure for the equational theory of an extension of the
 sigma-calculus by Abadi et al.  The library is completely written in Coq and
 uses Ltac to synthesize the substitution operation.")
       (license license:bsd-3))))
+
+(define-public coq-equations
+  (package
+    (name "coq-equations")
+    (version "1.2.3")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/mattam82/Coq-Equations")
+                    (commit (string-append "v" version "-8.11"))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1srxz1rws8jsh7402g2x2vcqgjbbsr64dxxj5d2zs48pmhb20csf"))))
+    (build-system gnu-build-system)
+    (native-inputs
+     `(("ocaml"  ,ocaml)
+       ("coq"    ,coq)
+       ("camlp5" ,camlp5)))
+    (arguments
+     `(#:test-target "test-suite"
+       #:phases
+       (modify-phases %standard-phases
+         (replace 'configure
+           (lambda* (#:key outputs #:allow-other-keys)
+             (invoke "sh" "./configure.sh")))
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (invoke "make"
+                     (string-append "COQLIB=" (assoc-ref outputs "out")
+                                    "/lib/coq/")
+                     "install"))))))
+    (home-page "https://mattam82.github.io/Coq-Equations/")
+    (synopsis "Function definition plugin for Coq")
+    (description "Equations provides a notation for writing programs
+by dependent pattern-matching and (well-founded) recursion in Coq.  It
+compiles everything down to eliminators for inductive types, equality
+and accessibility, providing a definitional extension to the Coq
+kernel.")
+    (license license:lgpl2.1)))
+
+(define-public coq-stdpp
+  (package
+    (name "coq-stdpp")
+    (version "1.4.0")
+    (synopsis "Alternative Coq standard library std++")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://gitlab.mpi-sws.org/iris/stdpp.git")
+                    (commit (string-append "coq-stdpp-" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1m6c7ibwc99jd4cv14v3r327spnfvdf3x2mnq51f9rz99rffk68r"))))
+    (build-system gnu-build-system)
+    (inputs
+     `(("coq" ,coq)))
+    (arguments
+     `(#:tests? #f ; Tests are executed during build phase.
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (invoke "make"
+                     (string-append "COQLIB=" (assoc-ref outputs "out")
+                                    "/lib/coq/")
+                     "install"))))))
+    (description "This project contains an extended \"Standard Library\" for
+Coq called coq-std++.  The key features are:
+@itemize
+@item Great number of definitions and lemmas for common data structures such
+as lists, finite maps, finite sets, and finite multisets.
+
+@item Type classes for common notations (like ∅, ∪, and Haskell-style monad
+notations) so that these can be overloaded for different data structures.
+
+@item It uses type classes to keep track of common properties of types, like
+it having decidable equality or being countable or finite.
+
+@item Most data structures are represented in canonical ways so that Leibniz
+equality can be used as much as possible (for example, for maps we have m1 =
+m2 iff ∀ i, m1 !! i = m2 !! i).  On top of that, the library provides setoid
+instances for most types and operations.
+
+@item Various tactics for common tasks, like an ssreflect inspired done tactic
+for finishing trivial goals, a simple breadth-first solver naive_solver, an
+equality simplifier simplify_eq, a solver solve_proper for proving
+compatibility of functions with respect to relations, and a solver set_solver
+for goals involving set operations.
+
+@item The library is dependency- and axiom-free.
+@end itemize")
+    (home-page "https://gitlab.mpi-sws.org/iris/stdpp")
+    (license license:bsd-3)))