Skip to content

Commit

Permalink
MAI: use TLA+ syntax in examples
Browse files Browse the repository at this point in the history
  • Loading branch information
johnyf committed Jan 12, 2021
1 parent 00d5559 commit c5f62fa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions examples/cudd_statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
def main():
b = cudd.BDD()
b.declare('x', 'y', 'z')
u = b.add_expr('x & y & z')
u = b.add_expr('x | y | ~ z')
u = b.add_expr('x /\ y /\ z')
u = b.add_expr('x \/ y \/ ~ z')
stats = b.statistics()
pprint.pprint(format_dict(stats))

Expand Down
13 changes: 7 additions & 6 deletions examples/reachability.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,20 @@ def transition_system(bdd):
dvars = ["x0", "x0'", "x1", "x1'"]
for var in dvars:
bdd.add_var(var)
s = (
"((!x0 & !x1) -> ( (!x0' & !x1') | (x0' & !x1') )) & "
"((x0 & !x1) -> ! (x0' & x1')) & "
"((!x0 & x1) -> ( (!x0' & x1') | (x0' & !x1') )) & "
"! (x0 & x1)")
s = '''
((~ x0 /\ ~ x1) => ( (~ x0' /\ ~ x1') \/ (x0' /\ ~ x1') ))
/\ ((x0 /\ ~ x1) => ~ (x0' /\ x1'))
/\ ((~ x0 /\ x1) => ( (~ x0' /\ x1') \/ (x0' /\ ~ x1') ))
/\ ~ (x0 /\ x1)
'''
transitions = bdd.add_expr(s)
return transitions


def least_fixpoint(transitions, bdd):
"""Return ancestor nodes."""
# target is the set {2}
target = bdd.add_expr('!x0 & x1')
target = bdd.add_expr('~ x0 /\ x1')
# start from empty set
q = bdd.false
qold = None
Expand Down

0 comments on commit c5f62fa

Please sign in to comment.