You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We seem to currently have an inconsistent state of existential variables.
The issue originally arose from this bug: runtimeverification/haskell-backend#3605, where the backend claims #Exists X . #Exists Y . { true #Equals 0 >Int Y } #And { true #Equals 0 <=Int X } is invalid.
Upon investigation, it turned out the backend was stripping the existentials (this change was introduced by runtimeverification/haskell-backend#3193) and essentially checking #Forall X . #Forall Y . { true #Equals 0 >Int Y } #And { true #Equals 0 <=Int X } with Z3, which is of course invalid.
However, when we try to revert the above change to get the correct behaviour for the aforementioned bug, we run into the following error:
This error arises when we get an existential variable appearing both in the configuration and the requires/ensures clause, e.g. when applying this foundry rule:
Quantifying both the term and the predicate probably means that there's
an error somewhere else.
variable=ConfigVarISEVENTEXPECTED'Unds'FINAL:SortBool{}
patt=\and{SortGeneratedTopCell{}}(
/* term: */
/* Sfa */
\exists{SortGeneratedTopCell{}}(
ConfigVarCHECKEDTOPICS'Unds'CELL'Unds'5d410f2a:SortList{},
/* Sfa */
\exists{SortGeneratedTopCell{}}(
ConfigVarCHECKEDDATA'Unds'CELL'Unds'5d410f2a:SortBool{},
/* Sfa */
\exists{SortGeneratedTopCell{}}(
ConfigVarEXPECTEDEVENTADDRESS'Unds'CELL'Unds'5d410f2a:SortAccount{},
/* Sfa */
\exists{SortGeneratedTopCell{}}(
ConfigVarISCALLWHITELISTACTIVE'Unds'FINAL:SortBool{},
/* Sfa */
\exists{SortGeneratedTopCell{}}(
ConfigVarISSTORAGEWHITELISTACTIVE'Unds'FINAL:SortBool{},
/* Sfa */
\exists{SortGeneratedTopCell{}}(
ConfigVarADDRESSSET'Unds'FINAL:SortSet{},
/* Sfa */
\exists{SortGeneratedTopCell{}}(
ConfigVarSTORAGESLOTSET'Unds'FINAL:SortSet{},
/* Sfa */
\exists{SortGeneratedTopCell{}}(
ConfigVarGENERATEDCOUNTER'Unds'CELL'Unds'5d410f2a:SortInt{},
...
\and{SortGeneratedTopCell{}}(
/* predicate: */
/* Sfa */
\equals{SortBool{}, SortGeneratedTopCell{}}(
/* T Fn D Sfa Cl */ \dv{SortBool{}}(\"true\"),
/* Fn Sfa */
Lblfoundry'Unds'success{}(
/* T Fn D Sfa */ ConfigVarSTATUSCODE'Unds'FINAL:SortStatusCode{},
/* T Fn D Sfa */
Lbl'Hash'lookup'LParUndsCommUndsRParUnds'EVM-TYPES'Unds'Int'Unds'Map'Unds'Int{}(
/* T Fn D Sfa */
ConfigVarCHEATCODE'Unds'STORAGE'Unds'FINAL:SortMap{},
/* T Fn D Sfa Cl */
\dv{SortInt{}}(\"46308022326495007027972728677917914892729792999299745830475596687180801507328\")
),
/* T Fn D Sfa */ ConfigVarISREVERTEXPECTED'Unds'FINAL:SortBool{},
/* T Fn D Sfa */ ConfigVarISOPCODEEXPECTED'Unds'FINAL:SortBool{},
/* T Fn D Sfa */ ConfigVarRECORDEVENT'Unds'FINAL:SortBool{},
/* T Fn D Sfa */ ConfigVarISEVENTEXPECTED'Unds'FINAL:SortBool{}
)
),
/* substitution: */
\top{SortGeneratedTopCell{}}()
))
Since the introduction of runtimeverification/haskell-backend#3193, we have essentially been turning all these existential variables into universal ones, hence the above error never occurred, but this is obviously not sound as evidenced by runtimeverification/haskell-backend#3605. The question is, which of the following options is the correct one?
We seem to currently have an inconsistent state of existential variables.
The issue originally arose from this bug: runtimeverification/haskell-backend#3605, where the backend claims
#Exists X . #Exists Y . { true #Equals 0 >Int Y } #And { true #Equals 0 <=Int X }is invalid.Upon investigation, it turned out the backend was stripping the existentials (this change was introduced by runtimeverification/haskell-backend#3193) and essentially checking
#Forall X . #Forall Y . { true #Equals 0 >Int Y } #And { true #Equals 0 <=Int X }with Z3, which is of course invalid.However, when we try to revert the above change to get the correct behaviour for the aforementioned bug, we run into the following error:
https://github.com/runtimeverification/haskell-backend/blob/2e33122cd354045da4e5f40dea9344e02c673a64/kore/src/Kore/Simplify/Exists.hs#L397-L401
This error arises when we get an existential variable appearing both in the configuration and the requires/ensures clause, e.g. when applying this foundry rule:
https://github.com/runtimeverification/evm-semantics/blob/c84e3466aa2ca2f4dea43870369b2ccab012e2f4/include/kframework/foundry.md?plain=1#L565-L570
since the above rule is encoded in kore as:
or whenever pyk sends over an implies request and explicitly applies an existential quantifier over any unbound variables on the RHS (from runtimeverification/haskell-backend#3620 (comment)):
Since the introduction of runtimeverification/haskell-backend#3193, we have essentially been turning all these existential variables into universal ones, hence the above error never occurred, but this is obviously not sound as evidenced by runtimeverification/haskell-backend#3605. The question is, which of the following options is the correct one?
?vars on the RHS of a rewrite rule to a universally quantified one (this is seemingly the status quo, given [Simplification request] Top-level existential elimination haskell-backend#3193