(bit_count)
return (TransitionSystem(variables, init, trans), [true_prop, false_prop])
Counter example with n bits and reset signal.
Counter example with n bits and reset signal.
Counter example with n bits and reset signal .
def counter(bit_count):
    """Counter example with n bits and reset signal."""

    # Example Counter System (SMV-like syntax)
    #
    # VAR bits: word[bit_count];
    #     reset: boolean;
    #
    # INIT: bits = 0 & reset = FALSE;
    #
    # TRANS: next(bits) = bits + 1
    # TRANS: next(bits = 0) <-> next(reset)

    from pysmt.typing import BVType
    bits = Symbol("bits", BVType(bit_count))
    nbits = next_var(bits)
    reset = Symbol("r", BOOL)
    nreset = next_var(reset)
    variables = [bits, reset]

    init = bits.Equals(0) & Not(reset)

    trans = nbits.Equals(bits + 1) &\
            (nbits.Equals(0)).Iff(nreset)

    # A true invariant property: (reset -> bits = 0)
    true_prop = reset.Implies(bits.Equals(0))

    # A false invariant property: (bits != 2**bit_count-1)
    false_prop = bits.NotEquals(2**bit_count -1)

    return (TransitionSystem(variables, init, trans), [true_prop, false_prop])
def counter ( bit_count ) : # Example Counter System (SMV-like syntax) # # VAR bits: word[bit_count]; #     reset: boolean; # # INIT: bits = 0 & reset = FALSE; # # TRANS: next(bits) = bits + 1 # TRANS: next(bits = 0) <-> next(reset) from pysmt . typing import BVType bits = Symbol ( "bits" , BVType ( bit_count ) ) nbits = next_var ( bits ) reset = Symbol ( "r" , BOOL ) nreset = next_var ( reset ) variables = [ bits , reset ] init = bits . Equals ( 0 ) & Not ( reset ) trans = nbits . Equals ( bits + 1 ) & ( nbits . Equals ( 0 ) ) . Iff ( nreset ) # A true invariant property: (reset -> bits = 0) true_prop = reset . Implies ( bits . Equals ( 0 ) ) # A false invariant property: (bits != 2**bit_count-1) false_prop = bits . NotEquals ( 2 ** bit_count - 1 ) return ( TransitionSystem ( variables , init , trans ) , [ true_prop , false_prop ] )