diff --git a/.obsidian/workspace.json b/.obsidian/workspace.json index e99d485..ddcaef0 100644 --- a/.obsidian/workspace.json +++ b/.obsidian/workspace.json @@ -13,7 +13,7 @@ "state": { "type": "markdown", "state": { - "file": "4a1s/CP/PL - Aula 7.md", + "file": "4a1s/MFES/PL - Aula 6.md", "mode": "source", "source": false } @@ -85,7 +85,7 @@ "state": { "type": "backlink", "state": { - "file": "4a1s/CP/PL - Aula 7.md", + "file": "4a1s/MFES/PL - Aula 6.md", "collapseAll": false, "extraContext": false, "sortOrder": "alphabetical", @@ -102,7 +102,7 @@ "state": { "type": "outgoing-link", "state": { - "file": "4a1s/CP/PL - Aula 7.md", + "file": "4a1s/MFES/PL - Aula 6.md", "linksCollapsed": false, "unlinkedCollapsed": true } @@ -125,7 +125,7 @@ "state": { "type": "outline", "state": { - "file": "4a1s/CP/PL - Aula 7.md" + "file": "4a1s/MFES/PL - Aula 6.md" } } }, @@ -158,17 +158,18 @@ "digitalgarden:Digital Garden Publication Center": false } }, - "active": "3ca14d4a6c304083", + "active": "abd7a3e8df397999", "lastOpenFiles": [ - "4a1s/CP/PL - Aula 6.md", + "4a1s/MFES/T - Aula 2.md", + "4a1s/MFES/PL - Aula 5.md", + "4a1s/MFES/PL - Aula 2.md", + "4a1s/MFES/PL - Aula 6.md", "4a1s/CP/PL - Aula 7.md", + "4a1s/CP/PL - Aula 6.md", "My Digital Garden.md", "Images/Pasted image 20231018122801.png", "Excalidraw/Drawing 2023-10-25 12.16.38.excalidraw.md", - "4a1s/MFES/T - Aula 2.md", - "4a1s/MFES/PL - Aula 5.md", "4a1s/MFES/PL - Aula 3.md", - "4a1s/MFES/PL - Aula 2.md", "4a1s/MFES/PL - Aula 4.md", "4a1s/MFES/PL - Aula 1.md", "4a1s/RAS/Notas Projeto RAS.md", diff --git a/4a1s/MFES/PL - Aula 6.md b/4a1s/MFES/PL - Aula 6.md new file mode 100644 index 0000000..97a0f71 --- /dev/null +++ b/4a1s/MFES/PL - Aula 6.md @@ -0,0 +1,139 @@ +```c +/* + +Finish the specification of this reservation concept, +including its events, scenarios, and operational principles. + +*/ + +sig Resource {} + +sig User { + var reservations : set Resource +} + +var sig Available in Resource {} + +pred reserve[u : User, r : Resource] { + r in Available + Available ' = Available - r + u.reservations ' = u.reservations + r + all x:User-u | x.reservations' = x.reservations +} + +pred cancel[u : User, r : Resource] { + // Cancel a reservation + +} + +pred use[u : User, r : Resource] { + // Use a reserved resource + +} + +pred cleanup { + // Make all used resources available again + +} + +pred stutter { + Available' = Available + reservations' = reservations +} + +fact { + Available = Resource + no reservations + always { + stutter + or + cleanup + or + (some u : User , r : Resource| reserve[u,r] or cancel[u,r] or use[u,r]) + } +} + +// Validation + +run Example { + // Empty run to be used for simulation +} + +run Scenario1 { + // An user reserves a resource, uses it, and finally a cleanup occurs + +} expect 1 + +run Scenario2 { + // An user reserves a resource, cancels the reservation, and reserves again + +} expect 1 + +run Scenario3 { + // An user reserves two resources, cancels one, uses the other, and finally a cleanup occurs + +} expect 1 + +run Scenario4 { + // Two users try to reserve the same resource + +} expect 0 + +run Scenario5 { + // Eventually a cleanup is performed twice in a row + +} expect 0 + +// Verification + +check OP1 { + // Reserved resources aren't available + +} + +check OP2 { + // Used resources were reserved before + +} + +check OP3 { + // Used resourcse can only be reserved again after a cleanup + +} + +check OP4 { + // After a cleanup all unreserved resources are available + +} + +check OP5 { + // Cancel undoes reserve + +} + +check OP6 { + // If a cleanup occurs some resource was used before + +} + +check OP7 { + // Used resource were not canceled since being reserved + +} + +check OP8 { + // Reserved resources can be used while not used or cenceled + +} + +check OP9 { + // The first event to occur will be a reservation + +} + +check OP10 { + // If cleanups and cancels never occur the available resources keep diminishing + +} + +``` \ No newline at end of file