Skip to content

Commit b11981c

Browse files
committed
Add base-API solver to Context
This is necessary for implementing recursive functions and makes Context align with Z3's behaviour.
1 parent 27d50b6 commit b11981c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

cvc5_pythonic_api/cvc5_pythonic.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ class Context(object):
146146

147147
def __init__(self):
148148
self.tm = pc.TermManager()
149+
self.solver = pc.Solver(self.tm)
149150
# Map from (name, sort) pairs to constant terms
150151
self.vars = {}
151152
# An increasing identifier used to make fresh identifiers
@@ -5990,9 +5991,8 @@ class Solver(object):
59905991

59915992
def __init__(self, ctx=None, logFile=None):
59925993
self.ctx = _get_ctx(ctx)
5993-
self.solver = None
5994+
self.solver = self.ctx.solver
59945995
self.logic = None
5995-
self.initFromLogic()
59965996
self.scopes = 0
59975997
self.assertions_ = [[]]
59985998
self.last_result = None
@@ -6002,6 +6002,7 @@ def __init__(self, ctx=None, logFile=None):
60026002
def initFromLogic(self):
60036003
"""Create the base-API solver from the logic"""
60046004
self.solver = pc.Solver(self.ctx.tm)
6005+
self.ctx.solver = self.solver
60056006
if self.logic is not None:
60066007
self.solver.setLogic(self.logic)
60076008
self.solver.setOption("produce-models", "true")

0 commit comments

Comments
 (0)