Skip to content

Booster implies endpoint improvements #4026

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

Merged
merged 19 commits into from
Aug 15, 2024
Merged

Conversation

goodlyrottenapple
Copy link
Contributor

Fixes #3941 along with a host of tests from the pyk testsuite, which exercise corner cases, such as #Bottom being sent as antecedent or inconsistent conditions. Whilst these haven't really been observed in practice, passing these tests should give is more confidence that the booster does the same thing as kore.

@geo2a geo2a linked an issue Aug 12, 2024 that may be closed by this pull request
@goodlyrottenapple goodlyrottenapple marked this pull request as ready for review August 12, 2024 10:26
explodeAnd other = [other]
explodeAnd :: Syntax.KorePattern -> NE.NonEmpty Syntax.KorePattern
explodeAnd Syntax.KJAnd{patterns} = case patterns of
[] -> error "malformed KJAnd"
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the benefit of having this function returning NonEmpty and exploding on an invalid And is not big, as we only use the non-empty in isTop/isBottom. I think we can just as well use the normal list there and avoid the call to error?

in runExcept $
internalisePatternOrTopOrBottom DisallowAlias CheckSubsorts Nothing def existentials korePat

checkImplies patL substitutionL unsupportedL existsL patR substitutionR unsupportedR existsR = do
Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with Jost that this function should be moved to a separate module.

Copy link
Member

@jberthold jberthold left a comment

Choose a reason for hiding this comment

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

A few question marks but a big step forward either way.
We can merge and follow up or adjust and then merge.

Comment on lines +135 to +142
pure . Left . RpcError.backendError . RpcError.ImplicationCheckError . RpcError.ErrorOnly . pack $
"match remainder: "
<> renderDefault
( hsep $
punctuate comma $
map (\(t1, t2) -> pretty' @mods t1 <+> "==" <+> pretty' @mods t2) $
NonEmpty.toList remainder
)
Copy link
Member

Choose a reason for hiding this comment

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

This could actually return "not implied" but returns an error at the moment so that proxy will call kore-rpc (I think).
Maybe add a comment to that effect. We could also return "not implied" and change proxy to re-validate this result, but throwing an error might be better for now.

MatchFailed{} ->
doesNotImply (sortOfPattern substPatL) antecedent.term consequent.term
MatchIndeterminate remainder ->
ApplyEquations.evaluatePattern def mLlvmLibrary solver mempty substPatL >>= \case
Copy link
Member

Choose a reason for hiding this comment

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

Would it make sense to also simplify substPatR ?

@rv-jenkins rv-jenkins merged commit edde779 into master Aug 15, 2024
6 checks passed
@rv-jenkins rv-jenkins deleted the sam/implies-improvements branch August 15, 2024 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Regression in the implies endpoint of booster-dev Add a few tests for booster's implication endpoint
4 participants