Skip to content

Added TLC models for all viable specs #110

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 26 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
4fb92bc
Added models for Stones, Bakery-Boulangerie, TeachingConcurrency
ahelwer Jan 18, 2024
dd2270d
Added model for LoopInvariance, tagged it as Beginner
ahelwer Jan 19, 2024
1ca579a
Fixed manifest.json format issue
ahelwer Jan 19, 2024
40a1089
Added models for bcastByz
ahelwer Jan 19, 2024
1962ef2
Added models for bcastByz and sums_even
ahelwer Jan 19, 2024
22ab008
Added models for TwoPhase and lamport_mutex
ahelwer Jan 19, 2024
4377c54
Added missing Paxos (How to Win a Turing Award) models
ahelwer Jan 19, 2024
06b7550
Added model for Chang-Roberts
ahelwer Jan 19, 2024
64cb2d2
Fixed ChangRoberts model
ahelwer Jan 19, 2024
d212e7a
Moved Paxos (Turing) models into directory
ahelwer Jan 22, 2024
36256b4
Added model for Aynchronous Byzantine Consensus
ahelwer Jan 22, 2024
153ebcd
Added model for Folklore Reliable Broadcast
ahelwer Jan 23, 2024
7b8e9b4
Re-added Paxos (Turing Award) toolbox setting files
ahelwer Jan 23, 2024
545a1a1
Added model for Bosco consensus
ahelwer Jan 23, 2024
dd1d486
Added model for c1cs
ahelwer Jan 23, 2024
e46331b
Added model for cf1s_folklore
ahelwer Jan 23, 2024
2b4386c
Added model for detector_chan96
ahelwer Jan 23, 2024
41d96ac
Added models for Async Commit specs
ahelwer Jan 23, 2024
30e196e
Added model for spanning
ahelwer Jan 23, 2024
197ef75
Added model for disk paxos
ahelwer Jan 25, 2024
076b287
Added models for TransactionCommit
ahelwer Jan 25, 2024
ccab4d0
Added models for SpanningTree
ahelwer Jan 25, 2024
027fd13
Fixed models for SpanningTree
ahelwer Jan 26, 2024
d9bba34
Added modles for Chameneos, CigaretteSmokers, GameOfLife, glowingRaccoon
ahelwer Jan 26, 2024
10e8445
Add missing models
ahelwer Jan 26, 2024
cf6051a
Added models for MisraReachability
ahelwer Jan 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/scripts/check_markdown_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ def from_json(spec):
for path, json, md in different_tlc_flag:
print(f'Spec {path} ' + ('incorrectly has' if md else 'is missing') + ' a TLC Model flag in README.md table')

'''
# Ensure Apalache flag is correct
different_apalache_flag = [
(manifest_spec.path, manifest_spec.apalache, table_spec.apalache)
Expand All @@ -191,6 +192,7 @@ def from_json(spec):
print('ERROR: Apalache Model flags in README.md table differ from model records in manifest.json:')
for path, json, md in different_tlc_flag:
print(f'Spec {path} ' + ('incorrectly has' if md else 'is missing') + ' an Apalache Model flag in README.md table')
'''

if success:
print('SUCCESS: manifest.json concords with README.md table')
Expand Down
3 changes: 3 additions & 0 deletions .github/scripts/check_small_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
parser.add_argument('--community_modules_jar_path', help='Path to the CommunityModules-deps.jar file', required=True)
parser.add_argument('--manifest_path', help='Path to the tlaplus/examples manifest.json file', required=True)
parser.add_argument('--skip', nargs='+', help='Space-separated list of models to skip checking', required=False, default=[])
parser.add_argument('--only', nargs='+', help='If provided, only check models in this space-separated list', required=False, default=[])
args = parser.parse_args()

logging.basicConfig(level=logging.INFO)
Expand All @@ -27,6 +28,7 @@
manifest_path = normpath(args.manifest_path)
examples_root = dirname(manifest_path)
skip_models = [normpath(path) for path in args.skip]
only_models = [normpath(path) for path in args.only]

def check_model(module_path, model, expected_runtime):
module_path = tla_utils.from_cwd(examples_root, module_path)
Expand Down Expand Up @@ -72,6 +74,7 @@ def check_model(module_path, model, expected_runtime):
for model in module['models']
if model['size'] == 'small'
and normpath(model['path']) not in skip_models
and (only_models == [] or normpath(model['path']) in only_models)
],
key = lambda m: m[2],
reverse=True
Expand Down
24 changes: 15 additions & 9 deletions .github/scripts/format_markdown_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@
parser.add_argument('--readme_path', help='Path to the tlaplus/examples README.md file', required=True)
args = parser.parse_args()

readme = None
with open(normpath(args.readme_path), 'r', encoding='utf-8') as readme_file:
readme = mistletoe.Document(readme_file)

columns = ['name', 'authors', 'beginner', 'proof', 'tlc', 'pcal', 'apalache']

def get_column(row, index):
Expand Down Expand Up @@ -64,11 +60,21 @@ def format_table(table):
'''
return

table = next((child for child in readme.children if isinstance(child, Table)))
format_table(table)
def format_document(document):
'''
All document transformations should go here.
'''
# Gets table of local specs
table = next((child for child in document.children if isinstance(child, Table)))
format_table(table)

# Write formatted markdown to README.md
with open(normpath(args.readme_path), 'w', encoding='utf-8') as readme_file:
with MarkdownRenderer() as renderer:
# Read, format, write
# Need to both parse & render within same MarkdownRenderer context to preserve other formatting
with MarkdownRenderer() as renderer:
readme = None
with open(normpath(args.readme_path), 'r', encoding='utf-8') as readme_file:
readme = mistletoe.Document(readme_file)
format_document(readme)
with open(normpath(args.readme_path), 'w', encoding='utf-8') as readme_file:
readme_file.write(renderer.render(readme))

13 changes: 9 additions & 4 deletions .github/scripts/generate_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,20 @@ def get_cfg_files(examples_root, tla_path):
Assume a .cfg file in the same directory as the .tla file and with the
same name is a model of that .tla file; also assume this of any .cfg
files where the .tla file name is only a prefix of the .cfg file name,
unless there are other .tla file names in the directory that exactly
match the .cfg file name.
unless there are other .tla file names in the directory that are longer
prefixes of the .cfg file name.
"""
parent_dir = dirname(tla_path)
module_name, _ = splitext(basename(tla_path))
other_module_names = [other for other in get_module_names_in_dir(examples_root, parent_dir) if other != module_name]
return [
path for path in glob.glob(f'{join(parent_dir, module_name)}*.cfg', root_dir=examples_root)
if splitext(basename(path))[0] not in other_module_names
path
for path in glob.glob(f'{join(parent_dir, module_name)}*.cfg', root_dir=examples_root)
if not any([
splitext(basename(path))[0].startswith(other_module_name)
for other_module_name in other_module_names
if len(other_module_name) > len(module_name)
])
]

def generate_new_manifest(examples_root, ignored_dirs, parser, queries):
Expand Down
1 change: 1 addition & 0 deletions .github/scripts/tla_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ def resolve_tlc_exit_code(code):
"""
tlc_exit_codes = {
0 : 'success',
10 : 'assumption failure',
11 : 'deadlock failure',
12 : 'safety failure',
13 : 'liveness failure'
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ jobs:
shell: bash
steps:
- name: Clone repo
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Install python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: adopt
java-version: 17
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@ pyvenv.cfg

## Ignore directories used for local CI testing
deps/
tree-sitter-tlaplus/

# Ignore TTrace specs
*_TTrace_*.tla

## Blacklist tools/ folder created by .devcontainer.json
tools/

Loading