Skip to content

Commit f76ab30

Browse files
committed
Update minimized predicate example
1 parent ecec9aa commit f76ab30

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,29 @@
1111
g.add_edge('cb_1', 'cb_2', stepFrom =1)
1212
g.add_edge('cb_1', 'l1', hasLabel = 1)
1313
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)
1515

1616
pr.settings.verbose = True
1717
pr.settings.atom_trace = True
1818
pr.settings.inconsistency_check = True
1919

2020
pr.load_graph(g)
2121

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)
2223
pr.add_closed_world_predicate('hackerControl')
24+
25+
# Initial fact instantiation
2326
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
2530
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
2633
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.
2837
pr.add_rule(pr.Rule('inconsistent(Y) <- future(Y), ~hackerControl(Y), ~hackerControl(X)', 'inconsistent_rule'))
2938

3039

0 commit comments

Comments
 (0)