Skip to content

Commit e3483b6

Browse files
committed
updates I/O spec generator to latest syntax changes in Gobra
1 parent a45f254 commit e3483b6

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

specification-generator/src/lib/tamigloo-compiler/src/PrettyIOSpecs/Gobra/FactEncoding.hs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ mFunc :: Document d => d
214214
mFunc =
215215
text "ghost" $$
216216
text "ensures res == (linearFacts(l) subset s && persistentFacts(l) subset s)" $$
217+
text "decreases" $$
217218
text "pure func M(l mset[Fact], s mset[Fact]) (res bool) {" $$
218219
nest 4 (
219220
text "// non-persistent facts" $$
@@ -231,6 +232,7 @@ uFunc :: Document d => d
231232
uFunc =
232233
text "ghost" $$
233234
text "ensures result == s setminus linearFacts(l) union r" $$
235+
text "decreases" $$
234236
text "pure func U(l mset[Fact], r mset[Fact], s mset[Fact]) (result mset[Fact])"
235237

236238
{- ---- -}
@@ -240,6 +242,7 @@ filterIsPersFunc =
240242
text "ghost" $$
241243
text "// returns a multiset containing just the persistent facts of l all with multiplicity 1" $$
242244
text "ensures forall f Fact :: { f # result } (f # result) == (persistent(f) && (f # l) > 0 ? 1 : 0)" $$
245+
text "decreases" $$
243246
text "pure func persistentFacts(l mset[Fact]) (result mset[Fact])"
244247

245248
{- ---- -}
@@ -249,6 +252,7 @@ filterIsLinFunc =
249252
text "ghost" $$
250253
text "// returns a multiset containing just the non-persistent facts of l while retaining their multiplicity" $$
251254
text "ensures forall f Fact :: { f # result } (f # result) == (persistent(f) ? 0 : (f # l))" $$
255+
text "decreases" $$
252256
text "pure func linearFacts(l mset[Fact]) (result mset[Fact])"
253257

254258

specification-generator/src/lib/tamigloo-compiler/src/PrettyIOSpecs/Gobra/PermissionEncoding.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ getPermDef p@(TID.IOSFpred (TID.Perm _ _name) _) =
160160
functionDefPerm perm@(TID.IOSFpred (TID.Perm _ _) _) n termsWithType retTermWithType =
161161
text "ghost" $$
162162
text "requires " <> permApp perm $$
163+
text "decreases" $$
163164
text "pure " <> functionDefDoc (text n) termsWithType (text retTermWithType)
164165
functionDefPerm _ _ _ _ = error "functionDefPerm called with wrong arguments."
165166
getPermDef _ = error "getPermDef called with wrong arguments."
@@ -278,6 +279,7 @@ internBIO p@(TID.IOSFpred (TID.Perm TID.Internal_R name) ts) =
278279
text "requires token(" <> placeSrc <> text ") && " <> permApp p $$
279280
text "ensures token(" <> placeDst <> text ") && " <> placeDst <> text " == old(" <>
280281
(getPermApp p !! 0) <> text ")" $$
282+
text "decreases" $$
281283
functionDefDoc (text $ "internBIO_" ++ name) argsWithType (parens retTermWithType)
282284
internBIO _ = error "internBIO not called with the right argument."
283285

specification-generator/src/lib/tamigloo-compiler/src/PrettyIOSpecs/Gobra/Utils.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ importHeader config importedPackages =
337337

338338
domain :: Document d => String -> d -> d
339339
domain name doc =
340-
braces' (text ("type " ++ name ++ " domain")) doc
340+
braces' (text ("ghost type " ++ name ++ " domain")) doc
341341

342342

343343
forallWithTriggerSetting :: Document d => TriggerSetting -> d -> [d] -> d -> d

0 commit comments

Comments
 (0)