Skip to content

Conversation

@mikand
Copy link
Contributor

@mikand mikand commented Jan 26, 2021

No description provided.

@mikand mikand self-assigned this Jan 26, 2021
Copy link
Contributor

@marcogario marcogario left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

could you update the PR description to clarify whether this is a bug or not?
Is the expectation that we always return assumptions in unsat cores or not?

I have some doubts about returning assumptions in the named unsat core case, but I do not see any harm in keeping this.

Comment on lines 236 to +238
btor_assumptions = [self.converter.convert(a) for a in assumptions]
self.btor.Assume(*btor_assumptions)
self._last_assumptions = list(assumptions)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If assumption is an iterator, we will consume it in L234, and then L238 will return an empty list.
Shall we do list(assumptions) earlier?

self.mgr = environment.formula_manager
self.declarations = {}
self._named_assertions = {}
self._last_assumptions = []
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe just assumptions? We cannot have multiple assumptions at the same time, right? That's why we are satisfied with storing only one set of assumptions.

# relies on this assertion stack being ordered
assert isinstance(self._assertion_stack, list)
btor_assertions = [self.converter.convert(a) for a in self._assertion_stack]
lst = self._assertion_stack + self._last_assumptions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe:

Suggested change
lst = self._assertion_stack + self._last_assumptions
assertions = self._assertion_stack + self._last_assumptions

if self.options.unsat_cores_mode == "named":
unsat_core = {}
# relies on this assertion stack being ordered
lst = list(self._named_assertions.keys()) + self._last_assumptions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above, let's use a more meaningful name here.

for a, in_core in zip(lst, in_unsat_core):
if in_core:
name = self._named_assertions[a]
name = self._named_assertions.get(a, '_a_%d' % cnt)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are making up the name for the assumption? If so, how is the caller supposed to link this information back? I wonder if in the named case returning the assumptions makes sense.

@marcogario marcogario added this to the 1.0.0 milestone Feb 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants