parametric example

This commit is contained in:
Artur Meski
2017-09-03 14:53:08 +01:00
parent ce6a1f6f19
commit 203182c520

View File

@@ -12,7 +12,39 @@ def run_tests():
# heat_shock_response() # heat_shock_response()
# scalable_chain(print_system=True) # scalable_chain(print_system=True)
# example44() # example44()
example44_param() # example44_param()
trivial_param()
def trivial_param():
r = ReactionSystemWithConcentrationsParam()
r.add_bg_set_entity(("x", 3))
r.add_bg_set_entity(("y", 3))
r.add_bg_set_entity(("c", 3))
r.add_bg_set_entity(("z", 3))
r.add_bg_set_entity(("final", 1))
r.add_reaction([("x", 1)], [("c", 1)], [("y", 2)])
r.add_reaction([("y", 1)], [("c", 1)], [("z", 1)])
r.add_reaction([("z", 1)], [("c", 1)], [("final", 1)])
c = ContextAutomatonWithConcentrations(r)
c.add_init_state("0")
c.add_state("1")
c.add_transition("0", [("x", 1)], "1")
c.add_transition("1", [], "1")
rc = ReactionSystemWithAutomaton(r, c)
rc.show()
smt_rsc = SmtCheckerRSCParam(rc)
f2 = Formula_rsLTL.f_F(
BagDescription.f_TRUE(),
BagDescription.f_entity("final") >= 1)
smt_rsc.check_rsltl(formula=f2)
def example44_param(): def example44_param():
@@ -39,7 +71,6 @@ def example44_param():
c.add_transition("1", [("x", 2), ("h", 1)], "1") c.add_transition("1", [("x", 2), ("h", 1)], "1")
c.add_transition("1", [("h", 1)], "1") c.add_transition("1", [("h", 1)], "1")
rc = ReactionSystemWithAutomaton(r, c) rc = ReactionSystemWithAutomaton(r, c)
rc.show() rc.show()
smt_rsc = SmtCheckerRSCParam(rc) smt_rsc = SmtCheckerRSCParam(rc)
@@ -68,15 +99,13 @@ def example44_param():
# we fix the property f1 # we fix the property f1
# this one holds: # this one holds:
f2 = Formula_rsLTL.f_G(BagDescription.f_entity("x") > 0, f2 = Formula_rsLTL.f_G(
Formula_rsLTL.f_Implies( BagDescription.f_entity("x") > 0, Formula_rsLTL.f_Implies(
(BagDescription.f_entity('y') == 2), (BagDescription.f_entity('y') == 2),
Formula_rsLTL.f_X( Formula_rsLTL.f_X(
(BagDescription.f_entity("x") > 1) & (BagDescription.f_entity("h") < 1), (BagDescription.f_entity("x") > 1) &
BagDescription.f_entity("y") >= 3 (BagDescription.f_entity("h") < 1),
) BagDescription.f_entity("y") >= 3)))
)
)
# neg_f1 = Formula_rsLTL.f_X(BagDescription.f_TRUE(), Formula_rsLTL.f_F(BagDescription.f_entity("x") > 0, # neg_f1 = Formula_rsLTL.f_X(BagDescription.f_TRUE(), Formula_rsLTL.f_F(BagDescription.f_entity("x") > 0,
# Formula_rsLTL.f_And( # Formula_rsLTL.f_And(
@@ -92,6 +121,7 @@ def example44_param():
# )) # ))
smt_rsc.check_rsltl(formula=neg_f1) smt_rsc.check_rsltl(formula=neg_f1)
def example44(): def example44():
r = ReactionSystemWithConcentrations() r = ReactionSystemWithConcentrations()
@@ -117,7 +147,6 @@ def example44():
c.add_transition("1", [("x", 2), ("h", 1)], "1") c.add_transition("1", [("x", 2), ("h", 1)], "1")
c.add_transition("1", [("h", 1)], "1") c.add_transition("1", [("h", 1)], "1")
rc = ReactionSystemWithAutomaton(r, c) rc = ReactionSystemWithAutomaton(r, c)
rc.show() rc.show()
smt_rsc = SmtCheckerRSC(rc) smt_rsc = SmtCheckerRSC(rc)
@@ -146,15 +175,13 @@ def example44():
# we fix the property f1 # we fix the property f1
# this one holds: # this one holds:
f2 = Formula_rsLTL.f_G(BagDescription.f_entity("x") > 0, f2 = Formula_rsLTL.f_G(
Formula_rsLTL.f_Implies( BagDescription.f_entity("x") > 0, Formula_rsLTL.f_Implies(
(BagDescription.f_entity('y') == 2), (BagDescription.f_entity('y') == 2),
Formula_rsLTL.f_X( Formula_rsLTL.f_X(
(BagDescription.f_entity("x") > 1) & (BagDescription.f_entity("h") < 1), (BagDescription.f_entity("x") > 1) &
BagDescription.f_entity("y") >= 3 (BagDescription.f_entity("h") < 1),
) BagDescription.f_entity("y") >= 3)))
)
)
# neg_f1 = Formula_rsLTL.f_X(BagDescription.f_TRUE(), Formula_rsLTL.f_F(BagDescription.f_entity("x") > 0, # neg_f1 = Formula_rsLTL.f_X(BagDescription.f_TRUE(), Formula_rsLTL.f_F(BagDescription.f_entity("x") > 0,
# Formula_rsLTL.f_And( # Formula_rsLTL.f_And(
@@ -170,6 +197,7 @@ def example44():
# )) # ))
smt_rsc.check_rsltl(formula=neg_f1) smt_rsc.check_rsltl(formula=neg_f1)
def heat_shock_response(print_system=True): def heat_shock_response(print_system=True):
stress_temp = 42 stress_temp = 42