diff --git a/courseA/IM_Alloy.html b/courseA/IM_Alloy.html index 94f270a..8106f23 100644 --- a/courseA/IM_Alloy.html +++ b/courseA/IM_Alloy.html @@ -191,30 +191,30 @@ } } -pred shippingOrReceiving[its, its': Inventory, itemId: ItemId, quantity: Int] { - plus[its.itemDB[itemId].count, quantity] < 0 implies { +pred receivingOrShipping[its, its': Inventory, itemId: ItemId, quantity: Int] { +
plus[its.itemDB[itemId].count, quantity] < 0 implies { all itemId': ItemId | its'.itemDB[itemId'] = its.itemDB[itemId'] } - else { + else {
some it': Item | { no itemId2: ItemId | its.itemDB[itemId2] = it' its'.itemDB = its.itemDB ++ itemId -> it' it'.name = its.itemDB[itemId].name it'.count = plus[its.itemDB[itemId].count, quantity] } - } +
}
} pred execute[] { - some disj its, its', its'', its''': Inventory, itemId: ItemId, n: Name | { +
some disj its, its', its'', its''': Inventory, itemId: ItemId, n: Name | {
init[its] itemRegistration[its, its', itemId, 100, n] - shippingOrReceiving[its', its'', itemId, -50] - shippingOrReceiving[its'', its''', itemId, -75] +
receivingOrShipping[its', its'', itemId, -50] + receivingOrShipping[its'', its''', itemId, -75]
} } -run execute for 2 but 4 Inventory, 8 Int +
run execute for 2 but 4 Inventory, 8 Int