forked from hwayne/learntla-v2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Another grand of words + screenshots
- Loading branch information
Showing
25 changed files
with
375 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
---- MODULE sum ---- | ||
EXTENDS Integers, Sequences, TLC, FiniteSets | ||
CONSTANT S | ||
ASSUME S \subseteq Int | ||
|
||
SumSeq(s) == 0 \* ??? | ||
|
||
(*--algorithm dup | ||
variable | ||
seq \in [1..5 -> S]; | ||
sum = 0; | ||
i = 1; | ||
|
||
define | ||
TypeInvariant == | ||
/\ sum \in Int | ||
/\ i \in 1..Len(seq)+1 | ||
|
||
IsCorrect == pc = "Done" => sum = SumSeq(seq) | ||
end define; | ||
|
||
macro add(x, val) begin | ||
x := x + val | ||
end macro; | ||
|
||
begin | ||
Iterate: | ||
while i <= Len(seq) do | ||
add(sum, seq[i]); | ||
add(i, 1); | ||
end while; | ||
end algorithm; *) | ||
==== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
---- MODULE trace ---- | ||
|
||
EXTENDS Integers, TLC | ||
|
||
(*--algorithm errortrace | ||
variable x=0; y=0; i=0; | ||
|
||
define | ||
xyleq10 == x * y <= 10 | ||
end define; | ||
|
||
process incX = "incX" | ||
begin | ||
EtX: | ||
while i < 8 do | ||
x := x + 1; | ||
i := i + 1; | ||
end while; | ||
end process; | ||
|
||
process incY = "incY" | ||
begin | ||
EtY: | ||
while i < 8 do | ||
y := y + 1; | ||
i := i + 1; | ||
end while; | ||
end process; | ||
|
||
end algorithm; *) | ||
|
||
|
||
==== | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
---- MODULE wire ---- | ||
EXTENDS TLC, Integers | ||
CONSTANTS People, Money, NumTransfers | ||
|
||
(* --algorithm wire | ||
variables | ||
acct \in [People -> Money]; | ||
|
||
define | ||
NoOverdrafts == | ||
\A p \in People: | ||
acct[p] >= 0 | ||
end define; | ||
|
||
process wire \in 1..NumTransfers | ||
variable | ||
amnt \in 1..5; | ||
from \in People; | ||
to \in People | ||
begin | ||
Check: | ||
if acct[from] >= amnt then | ||
Withdraw: | ||
acct[from] := acct[from] - amnt; | ||
Deposit: | ||
acct[to] := acct[to] + amnt; | ||
end if; | ||
end process; | ||
end algorithm; *) | ||
|
||
==== |
Oops, something went wrong.