-
Notifications
You must be signed in to change notification settings - Fork 150
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
pyk prove
cannot handle claims with #Equals
in requires
#4495
Comments
The sort of So we almost certainly don't want For more information, review the Matching Logic paper: https://fsl.cs.illinois.edu/publications/rosu-2017-lmcs.html, and the website: http://www.matching-logic.org/ |
The root cause is that $ kprove test-spec.k --emit-json-spec test-spec.json --dry-run test-spec.json{
"format": "KAST",
"version": 3,
"term": {
"node": "KFlatModuleList",
"mainModule": "TEST-SPEC",
"term": [
{
"node": "KFlatModule",
"name": "TEST-SPEC",
"imports": [
{
"node": "KImport",
"name": "TEST",
"isPublic": true
}
],
"localSentences": [
{
"node": "KClaim",
"body": {
"node": "KApply",
"label": {
"node": "KLabel",
"name": "<generatedTop>",
"params": []
},
"arity": 2,
"args": [
{
"node": "KApply",
"label": {
"node": "KLabel",
"name": "<test>",
"params": []
},
"arity": 1,
"args": [
{
"node": "KApply",
"label": {
"node": "KLabel",
"name": "<k>",
"params": []
},
"arity": 1,
"args": [
{
"node": "KToken",
"sort": {
"node": "KSort",
"name": "Int"
},
"token": "0"
}
]
}
]
},
{
"node": "KApply",
"label": {
"node": "KLabel",
"name": "<generatedCounter>",
"params": []
},
"arity": 1,
"args": [
{
"node": "KRewrite",
"lhs": {
"node": "KVariable",
"name": "_Gen0",
"sort": {
"node": "KSort",
"name": "Int"
}
},
"rhs": {
"node": "KVariable",
"name": "?_Gen1",
"sort": {
"node": "KSort",
"name": "Int"
}
}
}
]
}
]
},
"requires": {
"node": "KApply",
"label": {
"node": "KLabel",
"name": "#Equals",
"params": []
},
"arity": 2,
"args": [
{
"node": "KToken",
"sort": {
"node": "KSort",
"name": "Bool"
},
"token": "true"
},
{
"node": "KApply",
"label": {
"node": "KLabel",
"name": "_<Int_",
"params": []
},
"arity": 2,
"args": [
{
"node": "KToken",
"sort": {
"node": "KSort",
"name": "Int"
},
"token": "1"
},
{
"node": "KToken",
"sort": {
"node": "KSort",
"name": "Int"
},
"token": "2"
}
]
}
]
},
"ensures": {
"node": "KToken",
"sort": {
"node": "KSort",
"name": "Bool"
},
"token": "true"
},
"att": {
"node": "KAtt",
"att": {
"org.kframework.attributes.Location": [
3,
9,
4,
39
],
"org.kframework.attributes.Source": "/home/ttoth/git/k/pyk/test-spec.k",
"org.kframework.definition.Production": {
"node": "KProduction",
"klabel": {
"node": "KLabel",
"name": "#ruleRequires",
"params": []
},
"productionItems": [
{
"node": "KNonTerminal",
"sort": {
"node": "KSort",
"name": "#RuleBody"
}
},
{
"node": "KTerminal",
"value": "requires"
},
{
"node": "KNonTerminal",
"sort": {
"node": "KSort",
"name": "Bool"
}
}
],
"params": [],
"sort": {
"node": "KSort",
"name": "#RuleContent"
},
"att": {
"node": "KAtt",
"att": {
"klabel": "#ruleRequires",
"symbol": "",
"org.kframework.attributes.Location": [
346,
27,
346,
102
],
"org.kframework.attributes.Source": "/home/ttoth/git/k/k-distribution/target/release/k/include/kframework/builtin/kast.md"
}
}
},
"UNIQUE_ID": "8dc0e1d873088f3cfb273cf138f2b279914672cbcca7c71a8d04c25b3360ccd2"
}
}
}
],
"att": {
"node": "KAtt",
"att": {
"org.kframework.attributes.Location": [
1,
1,
5,
10
],
"org.kframework.attributes.Source": "/home/ttoth/git/k/pyk/test-spec.k",
"digest": "ha2k2aFsVNWhTxJB0GEX2k9yTwIiKVHGTACQyuDV2Ks="
}
}
}
]
}
} |
FWIW, using #Equals in requires is sometimes useful when the terms may not be defined, e.g.:
for testing that two maps either have the same value for
but the latter is significantly more verbose, and does not generalize (not all undefined functions have an "orDefault" version). Of course, while |
pyk prove
crashes with an error when trying to prove a spec claim with#Equals
in the requires clause when trying to resolve sorts for the rule.Steps to reproduce:
test.k
test-spec.k
pyk kompile test.k --backend haskell
pyk prove test-spec.k
Desired result:
The claim can be proven similarly to if the same files are used with
kompile test.k --backend haskell; kprove test-spec.k
.Actual result:
The text was updated successfully, but these errors were encountered: