Skip to content

Commit f8d1ee8

Browse files
committed
Added basic TLA+ lecture
1 parent 7602d53 commit f8d1ee8

22 files changed

+2267
-1
lines changed
Binary file not shown.

60009 - Distributed Algorithms/60009 - Distributed Algorithms.tex

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
\usepackage[a4paper, total={7in, 10in}]{geometry}
88
\input{../common/common.tex}
9+
\usepackage{packages/tlatex}
910

1011
\definecolor{threadBlue}{RGB}{204, 229, 255}
1112
\definecolor{threadYellow}{RGB}{255, 255, 136}
@@ -25,6 +26,8 @@
2526

2627
\addchapter{consensus}
2728

29+
\addchapter{tla_plus}
30+
2831
\addchapter{credit}
2932

3033
\end{document}

60009 - Distributed Algorithms/consensus/consensus.tex

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ \subsection{Valent Configurations}
119119
\subsection{Lemmas}
120120
\subsubsection{Confluence}
121121
\begin{center}
122-
\includegraphics[width=.6\textwidth]{consensus/images/lemma_confluence.drawio.png}
122+
\includegraphics[width=.3\textwidth]{consensus/images/lemma_confluence.drawio.png}
123123
\end{center}
124124
Given configuration $C$ and \textit{schedules} $\sigma_1$ and $\sigma_2$ such that set of processes with steps in $\sigma_1$ and $\sigma_2$ are disjoint:
125125
\[\sigma_1(\sigma_2(C)) \equiv \sigma_2(\sigma_1(C))\]

60009 - Distributed Algorithms/packages/tlatex.sty

+931
Large diffs are not rendered by default.

60009 - Distributed Algorithms/tla_plus/code/.gitkeep

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
\* SPECIFICATION
2+
\* Uncomment the previous line and provide the specification name if it's declared
3+
\* in the specification file. Comment INIT / NEXT parameters if you use SPECIFICATION.
4+
5+
CONSTANTS
6+
greeting = "Hello"
7+
8+
INIT Init
9+
NEXT Next
10+
11+
\* PROPERTY
12+
\* Uncomment the previous line and add property names
13+
14+
\* INVARIANT
15+
\* Uncomment the previous line and add invariant names
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
\tlatex
2+
\@x{}\moduleLeftDash\@xx{ {\MODULE} 24HourClock}\moduleRightDash\@xx{}%
3+
\@x{ {\EXTENDS} Naturals ,\, TLC}%
4+
\@x{ {\VARIABLE} hour}%
5+
\@x{}\midbar\@xx{}%
6+
\@x{ Init\@s{4.12} \.{\defeq} hour \.{\in} 0 \.{\dotdot} 23}%
7+
\@x{ Next \.{\defeq} hour \.{'} \.{=} ( hour \.{+} 1 ) \.{\%} 24}%
8+
\@x{\@s{39.83} \.{\land} (}%
9+
\@x{\@s{55.04} ( hour \.{\leq} 12 \.{\land} PrintT ( {\langle}\@w{[Morning]\
10+
time:} ,\, hour {\rangle} ) )}%
11+
\@x{\@s{43.93} \.{\lor} ( hour \.{>} 12 \.{\land} hour \.{<} 18 \.{\land}
12+
PrintT ( {\langle}\@w{[Afternoon]\ time:} ,\, hour {\rangle} ) )}%
13+
\@x{\@s{43.93} \.{\lor} ( hour \.{\geq} 18 \.{\land} PrintT (
14+
{\langle}\@w{[Evening]\ time:} ,\, hour {\rangle} ) )}%
15+
\@x{\@s{39.83} )}%
16+
\@x{ Spec\@s{1.46} \.{\defeq} Init \.{\land} {\langle} Next {\rangle}_{
17+
hour}}%
18+
\@x{}\midbar\@xx{}%
19+
\@x{ Typed \.{\defeq} {\Box} Init}%
20+
\@x{}\bottombar\@xx{}%
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---- MODULE 24HourClock ----
2+
EXTENDS Naturals, TLC
3+
VARIABLE hour
4+
-----------------------
5+
Init == hour \in 0..23
6+
Next == hour' = (hour + 1) % 24
7+
/\ (
8+
(hour <= 12 /\ PrintT(<<"[Morning] time:", hour>>))
9+
\/ (hour > 12 /\ hour < 18 /\ PrintT(<<"[Afternoon] time:", hour>>))
10+
\/ (hour >= 18 /\ PrintT(<<"[Evening] time:", hour>>))
11+
)
12+
Spec == Init /\ <<Next>>_hour
13+
-----------------------
14+
Typed == []Init
15+
====
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
\* SPECIFICATION
2+
\* Uncomment the previous line and provide the specification name if it's declared
3+
\* in the specification file. Comment INIT / NEXT parameters if you use SPECIFICATION.
4+
5+
CONSTANTS
6+
greeting = "Hello"
7+
8+
INIT Init
9+
NEXT Next
10+
11+
\* PROPERTY
12+
\* Uncomment the previous line and add property names
13+
14+
\* INVARIANT
15+
\* Uncomment the previous line and add invariant names
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
\tlatex
2+
\@x{}\moduleLeftDash\@xx{ {\MODULE} OneBitClock}\moduleRightDash\@xx{}%
3+
\@x{ {\VARIABLE} b}%
4+
\@x{ Type \.{\defeq} b \.{\in} \{ 0 ,\, 1 \}}%
5+
\@x{}\midbar\@xx{}%
6+
\@x{ Init\@s{4.12} \.{\defeq} b \.{=} 0 \.{\lor} b \.{=} 1}%
7+
\@x{ Next \.{\defeq} ( ( b \.{=} 0 ) \.{\land} ( b \.{'} \.{=} 1 ) ) \.{\lor}
8+
( ( b \.{=} 1 ) \.{\land} ( b \.{'} \.{=} 0 ) )}%
9+
\@x{ Spec\@s{1.46} \.{\defeq} Init \.{\land} {\Box} [ Next ]_{ b}}%
10+
\@x{}\midbar\@xx{}%
11+
\@x{ Typed \.{\defeq} {\Box} Type}%
12+
\@x{}\bottombar\@xx{}%
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---- MODULE OneBitClock ----
2+
VARIABLE b
3+
Type == b \in {0,1}
4+
-----------------------------
5+
Init == b=0 \/ b=1
6+
Next == ((b=0) /\ (b'=1)) \/ ((b=1) /\ (b'=0))
7+
Spec == Init /\ [][Next]_b
8+
-----------------------------
9+
Typed == []Type
10+
====
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
\* SPECIFICATION
2+
\* Uncomment the previous line and provide the specification name if it's declared
3+
\* in the specification file. Comment INIT / NEXT parameters if you use SPECIFICATION.
4+
5+
CONSTANTS
6+
greeting = "Hello"
7+
8+
INIT Init
9+
NEXT Next
10+
11+
\* PROPERTY
12+
\* Uncomment the previous line and add property names
13+
14+
\* INVARIANT
15+
\* Uncomment the previous line and add invariant names
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
\tlatex
2+
\@x{}\moduleLeftDash\@xx{ {\MODULE} TwelveHourClock}\moduleRightDash\@xx{}%
3+
\@x{ {\EXTENDS} Naturals}%
4+
\@x{ {\VARIABLE} hour}%
5+
\@x{}\midbar\@xx{}%
6+
\@x{ Init\@s{4.12} \.{\defeq} hour \.{\in} 0 \.{\dotdot} 11}%
7+
\@x{ Next \.{\defeq} hour \.{'} \.{=} ( hour \.{+} 1 ) \.{\%} 12}%
8+
\@x{ Spec\@s{1.46} \.{\defeq} Init \.{\land} {\Box} [ Next ]_{ hour}}%
9+
\@x{}\midbar\@xx{}%
10+
\@x{ Typed \.{\defeq} {\Box} Init}%
11+
\@x{}\bottombar\@xx{}%
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---- MODULE TwelveHourClock ----
2+
EXTENDS Naturals
3+
VARIABLE hour
4+
-----------------------
5+
Init == hour \in 0..11
6+
Next == hour' = (hour + 1) % 12
7+
Spec == Init /\ [][Next]_hour
8+
-----------------------
9+
Typed == []Init
10+
====
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)