예제 #1
0
def equivalent(a, phi):
  negphi = spot.formula.Not(phi)
  nega   = spot.dualize(spot.tgba_determinize(a))
  a2     = spot.ltl_to_tgba_fm(phi, dict)
  nega2  = spot.ltl_to_tgba_fm(negphi, dict)
  return spot.product(a, nega2).is_empty()\
         and spot.product(nega, a2).is_empty()
예제 #2
0
def equivalent(a, phi):
    negphi = spot.formula.Not(phi)
    nega = spot.dualize(spot.tgba_determinize(a))
    a2 = spot.ltl_to_tgba_fm(phi, dict)
    nega2 = spot.ltl_to_tgba_fm(negphi, dict)
    return spot.product(a, nega2).is_empty()\
           and spot.product(nega, a2).is_empty()
예제 #3
0
assert aut2.to_str() == """HOA: v1
States: 1
Start: 0
AP: 2 "a" "b"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels state-acc colored complete
properties: deterministic
--BODY--
State: 0 "[0,1]" {0}
[t] 0
--END--"""

aut = spot.translate('GF((p0 -> Gp0) R p1)')

daut = spot.tgba_determinize(aut, True)
assert daut.to_str() == """HOA: v1
States: 3
Start: 0
AP: 2 "p1" "p0"
acc-name: parity min even 3
Acceptance: 3 Inf(0) | (Fin(1) & Inf(2))
properties: trans-labels explicit-labels trans-acc complete
properties: deterministic stutter-invariant
--BODY--
State: 0 "{₀[0]₀}"
[!0&!1] 0
[!0&1] 0
[0&!1] 0 {0}
[0&1] 1 {2}
State: 1 "{₀[0]{₂[2]₂}₀}{₁[1]₁}"
예제 #4
0
# Test some function that must return exceptions on error.  Doing
# so is mostly a way to improve the coverage report.


import spot

try:
    spot.iar(spot.translate('GFa & GFb & GFc'))
except RuntimeError as e:
    assert 'iar() expects Rabin-like or Streett-like input' in str(e)

alt = spot.dualize(spot.translate('FGa | FGb'))

try:
    spot.tgba_determinize(alt)
except RuntimeError as e:
    assert 'tgba_determinize() does not support alternation' in str(e)


aut = spot.translate('a U b U c')
aps = aut.ap()
rem = spot.remove_ap()
rem.add_ap('"a"=0,b')
aut = rem.strip(aut)
assert aut.ap() == aps[2:]
try:
    rem.add_ap('"a=0,b')
except ValueError as e:
    assert """missing closing '"'""" in str(e)
예제 #5
0
[!0&!1&2] 1
State: 2
[0&!1&2] 7
State: 3
[!0&!1&2] 1
State: 4
[0&1&!2] 2
State: 5
[0&1&!2] 3
State: 6 {0}
[!0&1&!2] 6
State: 7 {0}
[0&!1&2] 7
--END--
""");

# In Reuben's report this first block built an incorrect deterministic
# automaton, which ultimately led to an non-empty product.  The second
# was fine.
print("use_simulation=True")
b1 = spot.tgba_determinize(b, False, True, True, True)
assert b1.num_states() == 5
b1 = spot.remove_fin(spot.dtwa_complement(b1))
assert not a.intersects(b1);

print("\nuse_simulation=False")
b2 = spot.tgba_determinize(b, False, True, False, True)
assert b2.num_states() == 5
b2 = spot.remove_fin(spot.dtwa_complement(b2))
assert not a.intersects(b1);
예제 #6
0
assert aut2.to_str() == """HOA: v1
States: 1
Start: 0
AP: 2 "a" "b"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels state-acc colored complete
properties: deterministic
--BODY--
State: 0 "[0,1]" {0}
[t] 0
--END--"""

aut = spot.translate('GF((p0 -> Gp0) R p1)')

daut = spot.tgba_determinize(aut, True)
assert daut.to_str() == """HOA: v1
States: 3
Start: 0
AP: 2 "p1" "p0"
acc-name: parity min odd 4
Acceptance: 4 Fin(0) & (Inf(1) | (Fin(2) & Inf(3)))
properties: trans-labels explicit-labels trans-acc complete
properties: deterministic stutter-invariant
--BODY--
State: 0 "{₀[0]₀}"
[!0&!1] 0
[!0&1] 0
[0&!1] 0 {1}
[0&1] 1 {3}
State: 1 "{₀[0]{₂[2]₂}₀}{₁[1]₁}"
예제 #7
0
def incl(a, b):
    return not b.intersects(spot.dualize(spot.tgba_determinize(a)))
예제 #8
0
# Test some function that must return exceptions on error.  Doing
# so is mostly a way to improve the coverage report.


import spot

try:
    spot.iar(spot.translate('GFa & GFb & GFc'))
except RuntimeError as e:
    assert 'iar() expects Rabin-like input' in str(e)

alt = spot.dualize(spot.translate('FGa | FGb'))

try:
    spot.tgba_determinize(alt)
except RuntimeError as e:
    assert 'tgba_determinize() does not support alternation' in str(e)


aut = spot.translate('a U b U c')
aps = aut.ap()
rem = spot.remove_ap()
rem.add_ap('"a"=0,b')
aut = rem.strip(aut)
assert aut.ap() == aps[2:]
try:
    rem.add_ap('"a=0,b')
except ValueError as e:
    assert """missing closing '"'""" in str(e)