Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Iterative term printer #421

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft

Iterative term printer #421

wants to merge 7 commits into from

Conversation

aehyvari
Copy link
Member

Our current method of printing interpolants and models in Interpret relies on Logic::pp, which is a recursive implementation. This PR presents a more robust implementation called TermPrinter, which is iterative and therefore requires a fixed-size stack. The printer still blows up the PTRef dag to a tree, similar to Logic::pp.

The implementation is based on the Rewriter class. However, since the does not actually rewrite anything, I created a Visitor class which allows passing Logic const &.

Between Visitor and Rewriter codes there's some code duplication that maybe could be removed, but I'm not sure how right now.

I didn't remove Logic::pp because I think it still has its place, at least when running stuff from debugger, but maybe also (as it currently is done) for some error messages.

@aehyvari aehyvari marked this pull request as draft February 18, 2022 18:04
aehyvari added 6 commits April 1, 2022 09:22
For a let term
`(let ((l1 phi1) ... (ln phin)) psi[l1/phi1 ...  ln/phin])`
it must not be the case that `li` appears in `psi[l1/phi1 ...  ln/phin]`
as a free variable.  This commit guarantees this by introducing a let
prefix in `Logic` and modifying it whenever a new variable is introduced
such that its name is a proper prefix of the current let prefix.

The current let prefix is modified by postfixing it with a character
different from the first character after the proper prefix in the new
variable.
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.

1 participant