Repository navigation
Improve parenthesization #2 - #1053
Merged
Merged
Conversation
…ormulas inside terms
…ly parenthesizing strings
MichaelRawson
approved these changes
Nov 7, 2026
MichaelRawson
left a comment
Contributor
There was a problem hiding this comment.
Cool! Guess you didn't need a precedence enumeration, only Boolean yes/no parens in the end?
Contributor
Author
Yes, turns out the precedences were set in the right way already for formulas, we just had some problems between term-formula boundaries. |
quickbeam123
approved these changes
Nov 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes most of the errors that GDV reported due to mostly not properly parenthesized higher-order or FOOL terms. It also removes a bunch of unneeded parenthesization. The idea is that we pass down a flag whether the outer context requires the inner context to parenthesize itself. The main guidelines are the following:
$true,$false, etc.See examples in testing code, we can discuss if something looks fishy.
There might be some places, like literals in clauses, where we had parentheses before and might need them again but GDV hasn't complained so far.
I also sneaked in a few smaller fixes for GDV, (1) using underscores for non-alphanumeric characters in inference names, and (2) fixing two-variable-equality sort recognition for literals in clauses.
There are a few small errors that still need fixing, mostly related to finding the right fragment we are in and wrong order of quantified variables.