Skip to content

Commit a35b49e

Browse files
authored
Rename z3 to pythonic api (#80)
A lot of the naming still suggests that this is somehow part of z3. While we incorporate code from z3 (and still acknowledge this), we now call everything cvc5_pythonic_api.
1 parent cbc2e18 commit a35b49e

26 files changed

Lines changed: 78 additions & 119 deletions

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ jobs:
2929
uses: actions/cache@v2
3030
with:
3131
path: ccache-dir
32-
key: cvc5-z3py-compat-ccache-${{ github.sha }}
33-
restore-keys: cvc5-z3py-compat-ccache-
32+
key: cvc5-pythonic-api-ccache-${{ github.sha }}
33+
restore-keys: cvc5-pythonic-api-ccache-
3434

3535
- name: Configure ccache
3636
shell: bash
@@ -45,7 +45,7 @@ jobs:
4545
uses: actions/cache@v2
4646
with:
4747
path: cvc5/build/deps
48-
key: cvc5-z3py-compat-deps-${{ hashFiles('cvc5/cmake/**') }}-${{ hashFiles('.github/**') }}
48+
key: cvc5-pythonic-api-deps-${{ hashFiles('cvc5/cmake/**') }}-${{ hashFiles('.github/**') }}
4949

5050
- name: Build cvc5
5151
run: |
@@ -54,7 +54,7 @@ jobs:
5454
cd build/
5555
make -j${{ env.num_proc }}
5656
57-
- name: Test z3py compatibility API
57+
- name: Test cvc5 pythonic API
5858
run: |
5959
make test
6060
env:

LICENSE.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
cvc5_z3py_compat is copyright (C) 2021 by its authors and contributors and
1+
cvc5_pythonic_api is copyright (C) 2021 by its authors and contributors and
22
their institutional affiliations. All rights reserved.
33

4-
The source code of cvc5_z3py_compat is open and available to students,
4+
The source code of cvc5_pythonic_api is open and available to students,
55
researchers, software companies, and everyone else to study, to modify, and to
66
redistribute original or modified versions; distribution is under the terms of
77
the modified BSD license (reproduced below). Note that the underlying
88
software, cvc5, includes it own license and restrictions. See
9-
https://github.com/cvc5/cvc5 for details. Note that cvc5_z3py_compat includes
9+
https://github.com/cvc5/cvc5 for details. Note that cvc5_pythonic_api includes
1010
source from Z3Py; see `license/z3.txt` for its license.
1111

1212
Redistribution and use in source and binary forms, with or without

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
.PHONY: test check fmt coverage
22

33
test:
4-
./z3doc_test.py && ./z3test.py
4+
./test_doc.py && ./test_unit.py
55

66
check:
7-
pyright ./cvc5_z3py_compat
7+
pyright ./cvc5_pythonic_api
88

99
fmt:
10-
black ./cvc5_z3py_compat
10+
black ./cvc5_pythonic_api
1111

1212
coverage:
13-
coverage run z3test.py && coverage report && coverage html
13+
coverage run test_unit.py && coverage report && coverage html

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# cvc5's Z3Py compatibility layer
1+
# cvc5's pythonic API
22

33
## Development requirements
44

cvc5_pythonic_api/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from .cvc5_pythonic import *
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"""
1212
cvc5 is an SMT solver.
1313
14-
This is its (as much as possible) Z3-compatible python interface.
14+
This is its pythonic API that is (as much as possible) Z3-compatible.
1515
1616
Several online tutorials for Z3Py are available at:
1717
http://rise4fun.com/Z3Py/tutorial/guide
@@ -68,7 +68,7 @@
6868
* as expected
6969
* Some pretty printing
7070
"""
71-
from .z3printer import *
71+
from .cvc5_pythonic_printer import *
7272
from fractions import Fraction
7373
from decimal import Decimal
7474
import ctypes
@@ -7060,7 +7060,7 @@ def fpToFP(a1, a2=None, a3=None, ctx=None):
70607060
elif is_fprm(a1) and is_bv(a2) and is_fp_sort(a3):
70617061
return fpSignedToFP(a1, a2, a3, ctx)
70627062
else:
7063-
raise Z3Exception("Unsupported combination of arguments for conversion to floating-point term.")
7063+
raise SMTException("Unsupported combination of arguments for conversion to floating-point term.")
70647064

70657065

70667066
def fpBVToFP(v, sort, ctx=None):
@@ -7250,13 +7250,13 @@ def _valid_accessor(acc):
72507250

72517251

72527252
class Datatype:
7253-
"""Helper class for declaring Z3 datatypes.
7253+
"""Helper class for declaring datatypes.
72547254
72557255
>>> List = Datatype('List')
72567256
>>> List.declare('cons', ('car', IntSort()), ('cdr', List))
72577257
>>> List.declare('nil')
72587258
>>> List = List.create()
7259-
>>> # List is now a Z3 declaration
7259+
>>> # List is now a declaration
72607260
>>> List.nil
72617261
nil
72627262
>>> List.cons(10, List.nil)
@@ -7413,7 +7413,7 @@ def CreateDatatypes(*ds):
74137413
ftype = uninterp_sorts[ftype.name]
74147414
else:
74157415
if debugging():
7416-
_assert(is_sort(ftype), "Z3 sort expected")
7416+
_assert(is_sort(ftype), "sort expected")
74177417
ftype = ftype.ast
74187418
con.addSelector(fname, ftype)
74197419
decl.addConstructor(con)
@@ -7447,13 +7447,13 @@ def __init__(self, ast, ctx=None):
74477447
self.dt = ast.getDatatype()
74487448

74497449
def num_constructors(self):
7450-
"""Return the number of constructors in the given Z3 datatype.
7450+
"""Return the number of constructors in the given datatype.
74517451
74527452
>>> List = Datatype('List')
74537453
>>> List.declare('cons', ('car', IntSort()), ('cdr', List))
74547454
>>> List.declare('nil')
74557455
>>> List = List.create()
7456-
>>> # List is now a Z3 declaration
7456+
>>> # List is now a declaration
74577457
>>> List.num_constructors()
74587458
2
74597459
"""
@@ -7466,7 +7466,7 @@ def constructor(self, idx):
74667466
>>> List.declare('cons', ('car', IntSort()), ('cdr', List))
74677467
>>> List.declare('nil')
74687468
>>> List = List.create()
7469-
>>> # List is now a Z3 declaration
7469+
>>> # List is now a declaration
74707470
>>> List.num_constructors()
74717471
2
74727472
>>> List.constructor(0)
@@ -7703,7 +7703,7 @@ class DatatypeRef(ExprRef):
77037703

77047704
def sort(self):
77057705
"""Return the datatype sort of the datatype expression `self`."""
7706-
return DatatypeSortRef(self.as_ast(), self.ctx)
7706+
return DatatypeSortRef(self.as_ast().getSort(), self.ctx)
77077707

77087708

77097709
def TupleSort(name, sorts, ctx=None):

0 commit comments

Comments
 (0)