|
11 | 11 | g.add_edge('cb_1', 'cb_2', stepFrom =1) |
12 | 12 | g.add_edge('cb_1', 'l1', hasLabel = 1) |
13 | 13 | g.add_edge('cb_2', 'l2', hasLabel = 1) |
14 | | -#g.add_edge('l1','l2', cond=1) # Adding this edge will |
| 14 | +#g.add_edge('l1','l2', cond=1) # Adding this edge will satisfy hackerControl(cb) |
15 | 15 |
|
16 | 16 | pr.settings.verbose = True |
17 | 17 | pr.settings.atom_trace = True |
18 | 18 | pr.settings.inconsistency_check = True |
19 | 19 |
|
20 | 20 | pr.load_graph(g) |
21 | 21 |
|
| 22 | +# hackerControl is a closed-world pred, meaning that it will be grounded as [0,0] if its bounds are [0,1] (or if it is not in the interpretation dict) |
22 | 23 | pr.add_closed_world_predicate('hackerControl') |
| 24 | + |
| 25 | +# Initial fact instantiation |
23 | 26 | pr.add_fact(pr.Fact('stepFrom(cb_1, cb_2)', 'step_from_fact', 0, 1)) |
24 | | -pr.add_fact(pr.Fact('hackerControl(cb_1)', 'hacker_control_initial_fact')) |
| 27 | +pr.add_fact(pr.Fact('hackerControl(cb_1)', 'hacker_control_initial_fact', 0, 0)) |
| 28 | + |
| 29 | +# Future(Y) will fire for cb_2 |
25 | 30 | pr.add_rule(pr.Rule('future(Y) <-1 stepFrom(X,Y), hackerControl(X)')) |
| 31 | + |
| 32 | +#This rule will not fire for cb_2, as cond(cb_1, cb_2) is not grounded |
26 | 33 | pr.add_rule(pr.Rule('hackerControl(Y) <-1 hackerControl(X), hasLabel(X,L1), hasLabel(Y,L2), cond(L1, L2), stepFrom(X,Y)', 'hacker-control-rule')) |
27 | | -pr.add_rule(pr.Rule('hackerControl(Y) <-1 hackerControl(X), hasLabel(X,L1), hasLabel(Y,L2), cond_1(L1, L2), stepFrom(X,Y)', 'hacker-control-rule-1')) |
| 34 | + |
| 35 | +# At timestep 1, hackerControl(cb_1) and hackerControl(cb_2) have no associated bounds, so they are treated as [0,1]. |
| 36 | +# Because hackerControl is minimized, its bounds are gounded as [0,0]. Future(cb_2) has bounds [1,1], so inconsistent(cb_2) fires. |
28 | 37 | pr.add_rule(pr.Rule('inconsistent(Y) <- future(Y), ~hackerControl(Y), ~hackerControl(X)', 'inconsistent_rule')) |
29 | 38 |
|
30 | 39 |
|
|
0 commit comments