runtimeverification / haskell-backend

The symbolic execution engine powering the K Framework
BSD 3-Clause "New" or "Revised" License
210 stars 42 forks source link

Haskell backend supports functional claims directly #3010

Open ehildenb opened 2 years ago

ehildenb commented 2 years ago

Part of https://github.com/runtimeverification/k/issues/2491

Should the backend be allowed to use these functional claims as lemmas directly? When discharging other proof goals, we could treat these functional claims as lemmas, to assist in those proofs.

ana-pantilie commented 2 years ago

Requires modifying kore-exec to detect "functional claims", which will be encoded as REQ -> (LHS #Equals (RHS #And ENS)) (in order to be very similar to actual simplification rules) inside spec modules. If the proof fails, return the claim as part of the stuck claims conjunction (as we do with the other type of claims).

See https://github.com/runtimeverification/haskell-backend/blob/master/kore/src/Kore/Reachability/Prove.hs

ana-pantilie commented 2 years ago

If implication simplification works as expected for this feature this should be small

ana-pantilie commented 2 years ago

@JKTKops We need to make sure that https://github.com/runtimeverification/haskell-backend/issues/3121 is supported in this feature. A similar test should be added when implementing this.

ana-pantilie commented 2 years ago

What would be the best way to represent EquationalClaims?

It's an implication, always of the form \\implies(requires, \\equals(leftTerm, \\and(rightTerm, ensures))).

simplify :: Pattern -> OrPattern

checkImplication :: claim -> LogicT m (CheckImplicationResult claim)

We want trans1 :: EquationalClaim -> Pattern and trans2 :: OrPattern -> EquationalClaim

For now let's go with EquationalClaim ~ OrPattern.

We will refactor class Claim later to make it more general.

ana-pantilie commented 2 years ago

https://github.com/runtimeverification/haskell-backend/blob/b06757e252ee01fdd5ab8f07de2910711997d845/kore/test/Test/ConsistentKore.hs#L204 is our Pattern generator

@radumereuta let us know when you have a working branch with the frontend support so that we can start integration testing.

radumereuta commented 2 years ago

Front end changes: https://github.com/runtimeverification/k/pull/2733

JKTKops commented 2 years ago

Status update posted on the PR.