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

Pretty-print SMT queries #3679

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Pretty-print SMT queries #3679

wants to merge 2 commits into from

Conversation

gebner
Copy link
Contributor

@gebner gebner commented Jan 15, 2025

This makes it easier to read the logged SMT queries without formatting them first. It also avoids the asymptotically quadratic string concatenation.

 ;;; Fact-ids: Name Prims.int; Namespace Prims
-(assert (! (forall ((@u0 Fuel) (@x1 Term))
- (! (implies (HasTypeFuel @u0
-@x1
-Prims.int)
-(is-BoxInt @x1))
-
-
-:pattern ((HasTypeFuel @u0
-@x1
-Prims.int))
-:qid int_inversion))
-:named int_inversion))
+(assert
+ (! (forall ((@u0 Fuel) (@x1 Term))
+   (! (implies (HasTypeFuel @u0 @x1 Prims.int) (is-BoxInt @x1))
+    :pattern ((HasTypeFuel @u0 @x1 Prims.int))
+    :qid int_inversion))
+  :named int_inversion))

As Nik suggested, I tried running this on deeply nested SMT queries from PulseCore. As expected, the indentation sometimes becomes large enough that the output contains one word per line. On PulseCore.IndirectionTheorySep there is a 10% increase in file size. To reduce the impact, I am only increasing the indentation by one space every time.

@gebner gebner force-pushed the gebner_pprint_smt branch from b850e9c to 329a2b2 Compare January 15, 2025 20:36
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