forked from informalsystems/hermes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ICS3Utils.tla
40 lines (27 loc) · 1.28 KB
/
ICS3Utils.tla
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
----------------------------- MODULE ICS3Utils -----------------------------
(***************************************************************************
This module is part of the TLA+ high-level specification for the
IBC Connection Handshake protocol (ICS3).
This module includes common action definitions that other modules need.
***************************************************************************)
EXTENDS Naturals, FiniteSets, Sequences
(* Obtain a set from the given sequence.
*)
SequenceAsSet(seq) ==
{seq[x] : x \in DOMAIN seq}
(* Checks if two version sequences overlap by taking the intersection of their
set representation.
*)
VersionSequencesOverlap(versionSeq1, versionSeq2) ==
SequenceAsSet(versionSeq1)
\intersect
SequenceAsSet(versionSeq2) /= {}
(* Checks if the versions of the two chain stores overlap; a wrapper over the
base action 'VersionSequencesOverlap'.
*)
ChainVersionsOverlap(chainStore, otherChainStore) ==
VersionSequencesOverlap(chainStore.connection.version, otherChainStore.connection.version)
=============================================================================
\* Modification History
\* Last modified Thu Aug 27 16:02:28 CEST 2020 by adi
\* Created Thu Aug 27 15:39:01 CEST 2020 by adi