-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Wei-jupiter-tla: formatting, overall slight refactor
- Loading branch information
hengxin
committed
Dec 31, 2018
1 parent
94cd9c3
commit ad7d44b
Showing
59 changed files
with
4,665 additions
and
488 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
42 changes: 13 additions & 29 deletions
42
...eng-Wei/Wei-jupiter-tla/AJupiterImplXJupiter.toolbox/AJupiterImplXJupiter/OpOperators.tla
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 |
---|---|---|
@@ -1,39 +1,23 @@ | ||
---------------------------- MODULE OpOperators ---------------------------- | ||
(***************************************************************************) | ||
(* Operators for Op. *) | ||
(***************************************************************************) | ||
(* | ||
Operators for Op. | ||
*) | ||
EXTENDS Naturals, Sequences, SequenceUtils | ||
|
||
Nop == PickNone(Nat) | ||
----------------------------------------------------------------------------- | ||
(*********************************************************************) | ||
(* The "Apply" operator which applies an operation op on the list l. *) | ||
(* *) | ||
(* Del: If pos > Len(l), the last element of l is deleted. *) | ||
(* This is realized by the DeleteElement operator. *) | ||
(* Ins: If pos > Len(l), the new element is appended to l. *) | ||
(* This is realized by the InsertElement operator. *) | ||
(*********************************************************************) | ||
Apply(op, l) == CASE op = Nop -> l | ||
[] op.type = "Rd" -> l | ||
[] op.type = "Del" -> DeleteElement(l, op.pos) | ||
[] op.type = "Ins" -> InsertElement(l, op.ch, op.pos) | ||
(*********************************************************************) | ||
(* The "ApplyOps" operator which applies an operation sequence ops *) | ||
(* on the list l. *) | ||
(*********************************************************************) | ||
RECURSIVE ApplyOps(_, _) | ||
Nop == PickNone(Nat) | ||
|
||
Apply(op, l) == \* Apply an operation op on the list l. | ||
CASE op = Nop -> l | ||
[] op.type = "Rd" -> l | ||
[] op.type = "Del" -> DeleteElement(l, op.pos) \* Last(l) is deleted if pos > Len(l) | ||
[] op.type = "Ins" -> InsertElement(l, op.ch, op.pos) \* Append(l, ch) if pos > Len(l) | ||
|
||
RECURSIVE ApplyOps(_, _) \* Apply an operation sequence ops on the list l. | ||
ApplyOps(ops, l) == | ||
IF ops = <<>> | ||
THEN l | ||
ELSE Apply(Last(ops), ApplyOps(AllButLast(ops), l)) | ||
----------------------------------------------------------------------------- | ||
(*********************************************************************) | ||
(* Check whether an operation op is legal with respect to the list l.*) | ||
(*********************************************************************) | ||
IsLegalOp(op, l) == CASE op.type = "Del" -> op.pos <= Len(l) | ||
[] op.type = "Ins" -> op.pos <= Len(l) + 1 | ||
============================================================================= | ||
\* Modification History | ||
\* Last modified Mon Dec 03 20:14:35 CST 2018 by hengxin | ||
\* Last modified Mon Dec 31 19:21:16 CST 2018 by hengxin | ||
\* Created Tue Aug 28 14:58:54 CST 2018 by hengxin |
Binary file modified
BIN
-273 Bytes
(100%)
tlaplus-projects/Hengfeng-Wei/Wei-jupiter-tla/AbsJupiterH.pdf
Binary file not shown.
Oops, something went wrong.