forked from Homebrew/homebrew-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmath-comp.rb
52 lines (41 loc) · 1.57 KB
/
math-comp.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
class MathComp < Formula
desc "Mathematical Components for the Coq proof assistant"
homepage "https://math-comp.github.io/math-comp/"
url "https://github.com/math-comp/math-comp/archive/mathcomp-1.9.0.tar.gz"
sha256 "fe3d157a4db7e96f39212f76e701a7fc1e3f125c54b8c38f06a6a387eda61c96"
revision 1
head "https://github.com/math-comp/math-comp.git"
bottle do
cellar :any_skip_relocation
sha256 "d873d09ef101a2d0e42e56c9d91db2b18b7fb55685ae2265175f0f922c37a576" => :mojave
sha256 "0bc3d27365c682708baf5592c106d87366f56e991a737f1665b2f39c8eb8a8dc" => :high_sierra
sha256 "ed75170ad9cc6081965f6bacfd927c0256536521c732989de5545a8c0a11332f" => :sierra
end
depends_on "ocaml" => :build
depends_on "coq"
def install
coqlib = "#{lib}/coq/"
(buildpath/"mathcomp/Makefile.coq.local").write <<~EOS
COQLIB=#{coqlib}
EOS
cd "mathcomp" do
system "make", "Makefile.coq"
system "make", "-f", "Makefile.coq", "MAKEFLAGS=#{ENV["MAKEFLAGS"]}"
system "make", "install", "MAKEFLAGS=#{ENV["MAKEFLAGS"]}"
elisp.install "ssreflect/pg-ssr.el"
end
doc.install Dir["docs/*"]
end
test do
(testpath/"testing.v").write <<~EOS
From mathcomp Require Import ssreflect seq.
Parameter T: Type.
Theorem test (s1 s2: seq T): size (s1 ++ s2) = size s1 + size s2.
Proof. by elim : s1 =>//= x s1 ->. Qed.
Check test.
EOS
coqc = Formula["coq"].opt_bin/"coqc"
cmd = "#{coqc} -R #{lib}/coq/user-contrib/mathcomp mathcomp testing.v"
assert_match /\Atest\s+: forall/, shell_output(cmd)
end
end