z3 0.0.20170204 → 0.0.20171020
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/z3/model.rb +6 -0
- data/lib/z3/solver.rb +16 -2
- data/spec/model_spec.rb +7 -0
- data/spec/solver_spec.rb +9 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f60c524dca681eab09bf92ff91d055060c806c80
|
4
|
+
data.tar.gz: e93747a1a7d10f62d1f8384f625c005651eeaf2e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c7282273ba2bc89bd26e7096104fde50487956994300765957495a0c123ca0f06897103512c01ab9121e3349715fe9bf02e71832a3a73a7d9664ae33d8a2c5a5
|
7
|
+
data.tar.gz: a44bdce9868882fee77cfc502d9c1e977dce11df27648025d06172512396c2c35ddd4b7b56ecefcd60a04d9012cd9db74e1f0eb06e2fdffc1cd2a416c89ddce5
|
data/lib/z3/model.rb
CHANGED
data/lib/z3/solver.rb
CHANGED
@@ -35,11 +35,25 @@ module Z3
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def satisfiable?
|
38
|
-
check
|
38
|
+
case check
|
39
|
+
when :sat
|
40
|
+
true
|
41
|
+
when :unsat
|
42
|
+
false
|
43
|
+
else
|
44
|
+
raise Z3::Exception, "Satisfiability unknown"
|
45
|
+
end
|
39
46
|
end
|
40
47
|
|
41
48
|
def unsatisfiable?
|
42
|
-
check
|
49
|
+
case check
|
50
|
+
when :unsat
|
51
|
+
true
|
52
|
+
when :sat
|
53
|
+
false
|
54
|
+
else
|
55
|
+
raise Z3::Exception, "Satisfiability unknown"
|
56
|
+
end
|
43
57
|
end
|
44
58
|
|
45
59
|
def model
|
data/spec/model_spec.rb
CHANGED
@@ -42,5 +42,12 @@ module Z3
|
|
42
42
|
expect(model.to_s).to eq("Z3::Model<a=2, b=4>")
|
43
43
|
expect(model.inspect).to eq("Z3::Model<a=2, b=4>")
|
44
44
|
end
|
45
|
+
|
46
|
+
it "#!" do
|
47
|
+
solver.assert(a == 2)
|
48
|
+
solver.assert(b == a+2)
|
49
|
+
expect(solver).to be_satisfiable
|
50
|
+
expect(!model).to be_same_as((a != 2) | (b != 4))
|
51
|
+
end
|
45
52
|
end
|
46
53
|
end
|
data/spec/solver_spec.rb
CHANGED
@@ -39,5 +39,14 @@ module Z3
|
|
39
39
|
stats = solver.statistics
|
40
40
|
expect(stats.keys).to match_array(["rlimit count", "max memory", "memory", "num allocs"])
|
41
41
|
end
|
42
|
+
|
43
|
+
# This is a very simple example of unknown satisfiablity
|
44
|
+
# so we might need more complex one in the future
|
45
|
+
it "third way" do
|
46
|
+
solver.assert a**3 == a
|
47
|
+
expect(solver.check).to eq(:unknown)
|
48
|
+
expect{solver.satisfiable?}.to raise_error("Satisfiability unknown")
|
49
|
+
expect{solver.unsatisfiable?}.to raise_error("Satisfiability unknown")
|
50
|
+
end
|
42
51
|
end
|
43
52
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: z3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.20171020
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomasz Wegrzanowski
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-10-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|