@@ -67,18 +67,23 @@ private def Method.Message.logicFun
67
67
&& Logic.checkResourcesPersistent consumedResObjs
68
68
&& Logic.checkResourcesPersistent createdResObjs
69
69
70
- /-- The class logic checks if all consumed messages in the action correspond
71
- to class members and the single consumed object is the receiver. -/
70
+ /-- The class logic checks if all consumed messages in the action correspond to
71
+ class members, the single consumed object is the receiver, and there is
72
+ at least one message. -/
72
73
private def logicFun {lab : Ecosystem.Label} {classId : lab.ClassId} (cl : Class classId) (args : Logic.Args) : Bool :=
73
74
let try self : Object classId.label := Object.fromResource args.self
74
75
check cl.invariant self args
75
76
match args.status with
76
77
| Created => true
77
78
| Consumed =>
78
79
let consumedMessageResources : List Anoma.Resource := Logic.selectMessageResources args.consumed
80
+ let nMessages := consumedMessageResources.length
79
81
let ! [consumedObjectResource] : List Anoma.Resource := Logic.selectObjectResources args.consumed
80
82
let try consumedObject : Object classId.label := Object.fromResource consumedObjectResource
81
- consumedMessageResources.length + 1 == (Logic.filterOutDummy args.consumed).length
83
+ -- NOTE: consumedObject == self by definition of Logic.Args; we only check
84
+ -- that there are no other consumed objects
85
+ nMessages >= 1
86
+ && nMessages + 1 == (Logic.filterOutDummy args.consumed).length
82
87
&& consumedMessageResources.all fun res =>
83
88
let try msg : Message classId.label := Message.fromResource res
84
89
consumedObject.uid == msg.recipient
0 commit comments