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

re-subclass Z3CAPITest #372

Closed
wants to merge 14 commits into from
Closed

re-subclass Z3CAPITest #372

wants to merge 14 commits into from

Conversation

shingarov
Copy link
Owner

No description provided.

shingarov and others added 14 commits October 13, 2024 08:50
Thus, the keyword #smt2: is gone in favor of unary #smt2.
This has the advantage that we don't have to lug the SymEnv as
argument to unFApp, z3sort etc.
A "bind" ties a name to a (refined) type.
Liquid-Fixpoint has two grammars for tests, the "Horn format"
and the "new format".  In the Horn format we write something like
```  (forall ((x int) (x>0)) ... )
and the above parses to an H.All over H.Bind, see `hBindP` in `Horn/Parse.hs`.
The "new format" for the same bind would be
```  {x: int | x > 0 }
see top-level `Parse.hs`.

Until today, we got away with simply calling them "bind" because we only
deal with the Horn format now, but introducing the "new format" leads to
confusion between the two; this commit renames those binds which mean hBind.
The initial objective of this work has been to factor common (non-Horn)
elements ouf of NNFParser to FixpointParser (so that the latter would
serve as a common superclass for NNFParser and FQParser, see #363).
As the work progressed, two other defects became evident: nomenclature
inconsistent with LiquidFixpoint, and the use of (extremely broken)
matchedParen even though we already have RefinementExpressionParser.
This commit addresses all three issues.

This is a combination of 23 commits:
Introduce FixpointParser which will serve as the common superclass of NNFParser/FQParser
Pull 'fixpoint' up to FixpointParser
Pull matchedParen and tok up to FixpointParser
Pull lowerId, upperId up to FixpointParser class
Consistently name hThing
Place parens in symSort (not its senders) for consistency with LF
Use naming for hCstr consistent with LF
Inline cstrAnd for consistency with LF
Parenthesize hBind consistently with LF
Inline #forall, #exists for consistency with LF
[cosmetic] Add "tag" TODO
Use naming for hCstr consistent with LF
Use naming for hPred consistent with LF
Inline predAnd for consistency with LF
Inline kappaApp, use kvSym for consistency with LF
Clear up confusion between pred, hPred and decidablePred
Inline #constant for consistency with LF
Rename qualif to hQualifier for consistency and to avoid confusion with F.qualifierP
Inline #constraint for consistency with LF
Rename var to hVar for consistency with LF
Pull common (i.e. non-Horn) elements from NNFParser to FixpointParser
Remove #matchedParen in favor of consistent use of RefinementExpressionParser
Route uses of RefinementExpressionParser through DecidableRefinement
This commit is merely refactoring of existing code to make it easier to
extend the list of "no-error-checked" APIs.
Some Z3 APIs don't clear error (like some dec_refs and possibly others),
so it could happen that, after encounting error (and reporting it)
we call another Z3 functions which does not clear it and subsequent
`#errorCheck` would report an error again (see [1]).

An obvious solution - not to call `#errorCheck` for those API - is bit
fragile - Z3 API is not explicit about which do and which don't and this
is known to change version to version.

So instead, we took the approach of clearing the error - this way each
(detected) error is reported only once.

[1]: #348
@shingarov
Copy link
Owner Author

Not meant for merging. This is just to see what CI will say, esp. about testEnum.

@shingarov
Copy link
Owner Author

Bad idea.

@shingarov shingarov closed this Oct 29, 2024
@shingarov shingarov deleted the resubclass-z3capi-test branch October 29, 2024 15:15
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.

2 participants