vault backup: 2023-10-30 12:36:28
This commit is contained in:
parent
39b2953f80
commit
926a6ef3f5
2 changed files with 149 additions and 9 deletions
19
.obsidian/workspace.json
vendored
19
.obsidian/workspace.json
vendored
|
@ -13,7 +13,7 @@
|
||||||
"state": {
|
"state": {
|
||||||
"type": "markdown",
|
"type": "markdown",
|
||||||
"state": {
|
"state": {
|
||||||
"file": "4a1s/CP/PL - Aula 7.md",
|
"file": "4a1s/MFES/PL - Aula 6.md",
|
||||||
"mode": "source",
|
"mode": "source",
|
||||||
"source": false
|
"source": false
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,7 @@
|
||||||
"state": {
|
"state": {
|
||||||
"type": "backlink",
|
"type": "backlink",
|
||||||
"state": {
|
"state": {
|
||||||
"file": "4a1s/CP/PL - Aula 7.md",
|
"file": "4a1s/MFES/PL - Aula 6.md",
|
||||||
"collapseAll": false,
|
"collapseAll": false,
|
||||||
"extraContext": false,
|
"extraContext": false,
|
||||||
"sortOrder": "alphabetical",
|
"sortOrder": "alphabetical",
|
||||||
|
@ -102,7 +102,7 @@
|
||||||
"state": {
|
"state": {
|
||||||
"type": "outgoing-link",
|
"type": "outgoing-link",
|
||||||
"state": {
|
"state": {
|
||||||
"file": "4a1s/CP/PL - Aula 7.md",
|
"file": "4a1s/MFES/PL - Aula 6.md",
|
||||||
"linksCollapsed": false,
|
"linksCollapsed": false,
|
||||||
"unlinkedCollapsed": true
|
"unlinkedCollapsed": true
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,7 @@
|
||||||
"state": {
|
"state": {
|
||||||
"type": "outline",
|
"type": "outline",
|
||||||
"state": {
|
"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
|
"digitalgarden:Digital Garden Publication Center": false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"active": "3ca14d4a6c304083",
|
"active": "abd7a3e8df397999",
|
||||||
"lastOpenFiles": [
|
"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 7.md",
|
||||||
|
"4a1s/CP/PL - Aula 6.md",
|
||||||
"My Digital Garden.md",
|
"My Digital Garden.md",
|
||||||
"Images/Pasted image 20231018122801.png",
|
"Images/Pasted image 20231018122801.png",
|
||||||
"Excalidraw/Drawing 2023-10-25 12.16.38.excalidraw.md",
|
"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 3.md",
|
||||||
"4a1s/MFES/PL - Aula 2.md",
|
|
||||||
"4a1s/MFES/PL - Aula 4.md",
|
"4a1s/MFES/PL - Aula 4.md",
|
||||||
"4a1s/MFES/PL - Aula 1.md",
|
"4a1s/MFES/PL - Aula 1.md",
|
||||||
"4a1s/RAS/Notas Projeto RAS.md",
|
"4a1s/RAS/Notas Projeto RAS.md",
|
||||||
|
|
139
4a1s/MFES/PL - Aula 6.md
Normal file
139
4a1s/MFES/PL - Aula 6.md
Normal file
|
@ -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
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
Loading…
Reference in a new issue