Skip to content

Commit

Permalink
Remove operators from define that do not appear in the PlusCal algori…
Browse files Browse the repository at this point in the history
…thm.

[Refactor]
  • Loading branch information
lemmy committed Mar 6, 2022
1 parent 08dd523 commit 15101fc
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions general-model/cosmos_client.tla
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,7 @@ Operations == [type: {"write"}, data: Nat, region: WriteRegions, client: Clients
ELSE <<es[1]>> \o RemDupRec(Tail(es), seen \cup {es[1]})

RemoveDuplicates(es) == RemDupRec(es, {})

SetMax(S) == IF S = {} THEN -1
ELSE CHOOSE i \in S : \A j \in S : i >= j

SeqToSet(s) == {s[i] : i \in DOMAIN s}


Last(s) == s[Len(s)]
}

Expand Down Expand Up @@ -196,11 +191,6 @@ RemDupRec(es, seen) == IF es = <<>> THEN <<>>

RemoveDuplicates(es) == RemDupRec(es, {})

SetMax(S) == IF S = {} THEN -1
ELSE CHOOSE i \in S : \A j \in S : i >= j

SeqToSet(s) == {s[i] : i \in DOMAIN s}

Last(s) == s[Len(s)]

VARIABLES session_token, numOp
Expand Down Expand Up @@ -287,10 +277,13 @@ Spec == /\ Init /\ [][Next]_vars
(* Check elements in History are type of Opertion *)
TypeOK == {History[i] : i \in DOMAIN History} \subseteq Operations


Range(s) == {s[i] : i \in DOMAIN s}

(* Read value in any regional database history *)
AnyReadPerRegion(r) == \A i \in DOMAIN History : /\ History[i].type = "read"
/\ History[i].region = r
=> History[i].data \in SeqToSet(Database[r]) \union {0}
=> History[i].data \in Range(Database[r]) \union {0}

(* Operation in history h is monitonic *)
Monotonic(h) == \A i, j \in DOMAIN h : i <= j => h[i].data <= h[j].data
Expand Down

0 comments on commit 15101fc

Please sign in to comment.