873 B
873 B
7. Paxos
CHOOSE
CHOOSE x \in S: P selects one particular value
in S such that P holds.
Example: how to write a maximum function:
Maximum(S) ==
IF S = {}
THEN -1
ELSE CHOOSE n \in S: \A m \in S: n >= m
Elements of a SYMMETRY set can not appear in a CHOOSE
expression.
Set constructors
{ v \in S: P }the set of allvinSfor whichPholds{e: v \in S}the set ofefor allvinS- Example:
{ n^2: n \in Nat }: the set of squares of all natural numbers
- Example:
EXCEPT drilling
[aState EXCEPT ![m.ins][acc].mbal = m.bal]
\* means
[aState EXCEPT ![m.ins] =
[aState[m.int] EXCEPT ![acc] =
[aState[m.ins][acc] EXCEPT !.mbal = m.bal]
]
]
\* just like this programming statement:
\* aState[m.ins][acc].mbal = mbal
