Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Preloaded Examples
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Monterey Phoenix
MP Model Collection
Preloaded Examples
Commits
d5d6bb88
Commit
d5d6bb88
authored
2 years ago
by
Pamela Dyer
Browse files
Options
Downloads
Patches
Plain Diff
Update Euclids_Algorithm.mp
parent
5d61456d
No related branches found
Branches containing commit
No related tags found
2 merge requests
!68
Update Euclids_Algorithm.mp
,
!67
Update Euclids_Algorithm.mp
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
models/Application_examples/Euclids_Algorithm.mp
+13
-15
13 additions, 15 deletions
models/Application_examples/Euclids_Algorithm.mp
with
13 additions
and
15 deletions
models/Application_examples/Euclids_Algorithm.mp
+
13
−
15
View file @
d5d6bb88
/*┬────────────────────────────────────────────────────────┐
/*┬────────────────────────────────────────────────────────┐
│*│ ┌─[ Title and Authors ]──────────────────────────────┐ │
│*│ ┌─[ Title and Authors ]──────────────────────────────┐ │
│*│ │ Model of Euclids Algorithm │ │
│*│ │ Model of Euclids Algorithm │ │
│*│ │ Created by Michael Collins │ │
│*│ │ Created by Michael Collins in October, 2022. │ │
│*│ │ October, 2022. │ │
│*│ │ Edited by Pamela Dyer and Kristin Giammarco in │ │
│*│ │ Edited by Pamela Dyer and Kristin Giammarco in │ │
│*│ │ October, 2022.
│ │
│*│ │
October, 2022. │ │
│*│ └────────────────────────────────────────────────────┘ │
│*│ └────────────────────────────────────────────────────┘ │
│*│ │
│*│ │
│*│ ┌─[ Purpose ]────────────────────────────────────────┐ │
│*│ ┌─[ Purpose ]────────────────────────────────────────┐ │
│*│ │ To use MP to model an adaptation of the well-known │ │
│*│ │ To use MP to model an adaptation of the well-known │ │
│*│ │ Greatest Common Divisor Algorithm by Euclid.
│ │
│*│ │ Greatest Common Divisor
(GCD)
Algorithm by Euclid. │ │
│*│ └────────────────────────────────────────────────────┘ │
│*│ └────────────────────────────────────────────────────┘ │
│*│ │
│*│ │
│*│ ┌─[ Description ]────────────────────────────────────┐ │
│*│ ┌─[ Description ]────────────────────────────────────┐ │
...
@@ -22,33 +21,31 @@
...
@@ -22,33 +21,31 @@
│*│ ┌─[ References ]─────────────────────────────────────┐ │
│*│ ┌─[ References ]─────────────────────────────────────┐ │
│*│ │ Leslie Lamport's Introduction to TLA+ | |
│*│ │ Leslie Lamport's Introduction to TLA+ | |
│*│ │ https://www.newsroom.hlf-foundation.org/newsroom/ | |
│*│ │ https://www.newsroom.hlf-foundation.org/newsroom/ | |
│*│ │ https://www.newsroom.hlf-foundation.org/newsroom/ | |
│*│ │ https://www.newsroom.hlf-foundation.org/newsroom/lectures/video/lecture-if-youre-not-writing-a-program-dont-use-a-programming-language.html
|*| | lectures/video/lecture-if-youre-not-writing-a- | |
|*| | program-dont-use-a-programming-language.html | |
│*│ └────────────────────────────────────────────────────┘ │
│*│ └────────────────────────────────────────────────────┘ │
│*│ │
│*│ │
│*│ ┌─[ Search Terms ]───────────────────────────────────┐ │
│*│ ┌─[ Search Terms ]───────────────────────────────────┐ │
│*│ │ behavior, Euclid
,
GCD
,
Lamport
; │ │
│*│ │ behavior, Euclid
;
GCD
;
Lamport;
│ │
│*│ │ coordination, event;
coordination
, conditional
;
│ │
│*│ │ coordination, event;
ENSURE
, conditional
│ │
│*│ └────────────────────────────────────────────────────┘ │
│*│ └────────────────────────────────────────────────────┘ │
│*│ │
│*│ │
│*│ ┌─[ Instructions ]───────────────────────────────────┐ │
│*│ ┌─[ Instructions ]───────────────────────────────────┐ │
│*│ │ Run for Scopes 1, 2, and 3. │ │
│*│ │ Run for Scopes 1, 2, and 3. │ │
│*│ ├─[ Run Statistics ]─────────────────────────────────┤ │
│*│ ├─[ Run Statistics ]─────────────────────────────────┤ │
│*│ │ Scope 1: 4 traces in less than 1 sec. │ │
│*│ │ Scope 1: 4 traces in less than 1 sec. │ │
│*│ │ Scope 2: 1
1
traces in less than 1 sec. │ │
│*│ │ Scope 2: 1
0
traces in less than 1 sec. │ │
│*│ │ Scope 3: 2
6
traces in less than 1 sec. │ │
│*│ │ Scope 3: 2
2
traces in less than 1 sec. │ │
│*│ └────────────────────────────────────────────────────┘ │
│*│ └────────────────────────────────────────────────────┘ │
└*┴───────────────────────────────────────────────────────*/
└*┴───────────────────────────────────────────────────────*/
SCHEMA Euclids_Algorithm
SCHEMA Euclids_Algorithm
ROOT GCD:
set_initial_value_for_x
ROOT GCD:
set_initial_value_for_x
set_initial_Value_for_y
set_initial_Value_for_y
(*
(*
( x_has_become_greater_than_y
( x_has_become_greater_than_y
x_is
assigned_new_value_of_y_subtracted_from_x
x_is
_
assigned_new_value_of_y_subtracted_from_x
y_does_not_change_value
y_does_not_change_value
|
|
y_has_become_greater_than_x
y_has_become_greater_than_x
...
@@ -62,7 +59,8 @@ ROOT GCD: set_initial_value_for_x
...
@@ -62,7 +59,8 @@ ROOT GCD: set_initial_value_for_x
IF #x_equals_y > 0 THEN
IF #x_equals_y > 0 THEN
ENSURE FOREACH $x:x_equals_y
ENSURE #x_equals_y == 1;
ENSURE FOREACH $x: x_equals_y
#x_has_become_greater_than_y AFTER $x == 0 AND
#x_has_become_greater_than_y AFTER $x == 0 AND
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment