예제 #1
0
파일: prime.py 프로젝트: ciniks117/omega
def vars_in_support(u, fol):
    """Return variables that `u` depends on.

    Returns unprimed identifiers for all variables
    that occur (primed or not) in the support of `u`.
    """
    vrs = set()
    for k in fol.support(u):
        if stx.isprimed(k):
            vrs.add(stx.unprime(k))
        elif is_variable(k, fol):
            vrs.add(k)
    assert vrs == (flexible_support(u, fol)
                   | {stx.unprime(s)
                      for s in primed_support(u, fol)})
    return vrs
예제 #2
0
파일: bitvector.py 프로젝트: johnyf/omega
def _add_bitnames(t):
    """Map each integer to a list of bit variables."""
    for var, d in t.items():
        if d['type'] != 'int':
            continue
        assert d['type'] == 'int', d['type']
        if stx.isprimed(var):
            name = stx.unprime(var)
            prime = stx.PRIME
        else:
            name = var
            prime = ''
        bits = [
            '{name}_{i}{prime}'.format(
                name=name, i=i, prime=prime)
            for i in range(d['width'])]
        are_booleans = list(filter(t.__contains__, bits))
        assert not are_booleans, (bits, t)
        d['bitnames'] = bits
예제 #3
0
 def assert_consistent(self, moore=True):
     """Assert that `init` and `win` contain state predicates."""
     varlists = list(self.varlist.values())
     assert pairwise_disjoint(varlists)
     for u in self.init.values():
         assert sym_bdd.is_state_predicate(u)
     # Moore actions
     for player, action in self.action.items():
         primed = {
             stx.unprime(var)
             for var in self.support(action) if stx.isprimed(var)
         }
         # applicable only after unzip
         # assert primed.issubset(self.varlist[player]), (
         #     (player, primed))
     for d in self.win.values():
         for v in d.values():
             for u in v:
                 assert sym_bdd.is_state_predicate(u)
예제 #4
0
def _add_bitnames(t):
    """Map each integer to a list of bit variables."""
    for var, d in t.items():
        if d['type'] != 'int':
            continue
        assert d['type'] == 'int', d['type']
        if stx.isprimed(var):
            name = stx.unprime(var)
            prime = stx.PRIME
        else:
            name = var
            prime = ''
        bits = [
            '{name}_{i}{prime}'.format(name=name, i=i, prime=prime)
            for i in range(d['width'])
        ]
        are_booleans = list(filter(t.__contains__, bits))
        assert not are_booleans, (bits, t)
        d['bitnames'] = bits
예제 #5
0
파일: steps.py 프로젝트: tichakornw/omega
def _unprime_state(primed_state):
    """Return same state but with identifiers unprimed."""
    return {stx.unprime(k): v for k, v in primed_state.items()}
예제 #6
0
파일: prime.py 프로젝트: ciniks117/omega
def unprime(u, fol):
    """Unprime primed variables in support of `u`."""
    primed_vars = primed_support(u, fol)
    let = {s: stx.unprime(s) for s in primed_vars}
    return fol.let(let, u)
예제 #7
0
 def unprime_vars(self, vrs):
     """Return `list` of primed variables from `vrs`."""
     return [stx.unprime(var) for var in vrs]
예제 #8
0
파일: prime.py 프로젝트: johnyf/omega
def unprime(u, fol):
    """Unprime primed variables in support of `u`."""
    primed_vars = primed_support(u, fol)
    let = {s: stx.unprime(s) for s in primed_vars}
    return fol.let(let, u)