homebrew-core/Formula/coq.rb
2017-10-18 07:42:37 -07:00

78 lines
2.3 KiB
Ruby

class Camlp5TransitionalModeRequirement < Requirement
fatal true
satisfy(:build_env => false) { !Tab.for_name("camlp5").with?("strict") }
def message; <<-EOS.undent
camlp5 must be compiled in transitional mode (instead of --strict mode):
brew install camlp5
EOS
end
end
class Coq < Formula
desc "Proof assistant for higher-order logic"
homepage "https://coq.inria.fr/"
url "https://github.com/coq/coq/archive/V8.7.0.tar.gz"
sha256 "f376207ed051b3fd27c519f44b25eb25f8dddbce22715f68c3cedfd2e4b39297"
head "https://github.com/coq/coq.git"
bottle do
sha256 "9fb0fc75bd4e70ded62131e90ab69f864eea83f8e36af4c796bdd9fab9b6a188" => :high_sierra
sha256 "b338308d66bb15c1869d4d2fd2866c60c123aa0d64468e8ddc8f6877a9bcf016" => :sierra
sha256 "1436182a25030ea3e118f696a3df0606957734bb000d782fef8ab021b8c0b687" => :el_capitan
end
depends_on "opam" => :build
depends_on Camlp5TransitionalModeRequirement
depends_on "camlp5"
depends_on "ocaml"
def install
ENV["OPAMYES"] = "1"
opamroot = buildpath/"../opamroot"
opamroot.mkpath
ENV["OPAMROOT"] = opamroot
system "opam", "init", "--no-setup"
system "opam", "install", "ocamlfind"
system "opam", "config", "exec", "--",
"./configure", "-prefix", prefix,
"-mandir", man,
"-emacslib", elisp,
"-coqdocdir", "#{pkgshare}/latex",
"-coqide", "no",
"-with-doc", "no"
system "make", "world"
ENV.deparallelize { system "make", "install" }
end
test do
(testpath/"testing.v").write <<-EOS.undent
Require Coq.omega.Omega.
Require Coq.ZArith.ZArith.
Inductive nat : Set :=
| O : nat
| S : nat -> nat.
Fixpoint add (n m: nat) : nat :=
match n with
| O => m
| S n' => S (add n' m)
end.
Lemma add_O_r : forall (n: nat), add n O = n.
Proof.
intros n; induction n; simpl; auto; rewrite IHn; auto.
Qed.
Import Coq.omega.Omega.
Import Coq.ZArith.ZArith.
Open Scope Z.
Lemma add_O_r_Z : forall (n: Z), n + 0 = n.
Proof.
intros; omega.
Qed.
EOS
system("#{bin}/coqc", "#{testpath}/testing.v")
end
end