Skip to content

Commit d32e013

Browse files
committed
TLC fails to evaluate Graphs!Path because of Seq
Addresses Github issue #58 #58 [Refactor]
1 parent cae9a76 commit d32e013

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

modules/Graphs.tla

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ SimplePath(G) ==
3636
/\ \A i \in 1..(Len(p)-1) : <<p[i], p[i+1]>> \in G.edge}
3737

3838
AreConnectedIn(m, n, G) ==
39-
\E p \in Path(G) : (p[1] = m) /\ (p[Len(p)] = n)
39+
\E p \in SimplePath(G) : (p[1] = m) /\ (p[Len(p)] = n)
4040

4141
IsStronglyConnected(G) ==
4242
\A m, n \in G.node : AreConnectedIn(m, n, G)
@@ -47,3 +47,6 @@ IsTreeWithRoot(G, r) ==
4747
/\ \A f \in G.edge : (e[1] = f[1]) => (e = f)
4848
/\ \A n \in G.node : AreConnectedIn(n, r, G)
4949
=============================================================================
50+
\* Modification History
51+
\* Last modified Tue Dec 21 15:55:45 PST 2021 by Markus Kuppe
52+
\* Created Tue Jun 18 11:44:08 PST 2002 by Leslie Lamport

tests/GraphsTests.tla

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,14 @@ ASSUME AssertEq(SimplePath([edge|-> {}, node |-> {}]), {})
77
ASSUME AssertEq(SimplePath([edge|-> {}, node |-> {1,2,3}]), {<<1>>, <<2>>, <<3>>})
88
ASSUME AssertEq(SimplePath([edge|-> {<<1,2>>, <<2,3>>}, node |-> {1,2,3}]),
99
{ <<1>>, <<2>>, <<3>>, <<1,2>>, <<2,3>>, <<1,2,3>> } )
10-
11-
=====================================================================
10+
11+
Graphs(nodes) ==
12+
[node : {nodes}, edge : SUBSET (nodes \X nodes)]
13+
14+
ASSUME \A g \in Graphs({"A", "B", "C"}):
15+
\A u,v \in g.node :
16+
AreConnectedIn(u, v, g) \in BOOLEAN
17+
=====================================================================
18+
\* Modification History
19+
\* Last modified Tue Dec 21 15:55:45 PST 2021 by Markus Kuppe
20+
\* Created Mon Dec 20 20:55:45 PST 2021 by Markus Kuppe

0 commit comments

Comments
 (0)