Example #1
0
def test_graph_form2():
    Graphs = []
    Sets = []
    formulas_in = {}
    formulas_in[1] = []
    G = nx.MultiDiGraph()
    str_psi = "(Bp ^ Dq) "
    psi = syntax.parse_formula(SET, str_psi)
    Sets.append(sols.recursivealpha(psi))
    gr.create_graph_K(G,Sets)
    Graphs.append(G)
    #apply delta expansion
    l.delta_node_solve(G, 1 ,formulas_in)
    #check if node 1 has correct formula
    assert G.node[1] == [('box', 'p'), ('diamond', 'q')]
    #check new node contains expanded delta and gamma formulas
    assert G.node[2] == ['q','p']
Example #2
0
def test_graph_form3():
    l.Graphs = []
    Sets = []
    formulas_in = {}
    formulas_in[1] = []
    G = nx.MultiDiGraph()
    str_psi = "(Bp V Dq)"
    psi = syntax.parse_formula(SET, str_psi)
    Sets.append(sols.recursivealpha(psi))
    gr.create_graph_K(G,Sets)
    l.Graphs.append(G)
    #apply beta expansion
    l.beta_node_solve(G, 1 ,formulas_in)
    #check if there are 2 graphs
    assert len(l.Graphs) == 2
    #check if there are correct formulas in node 1
    assert l.Graphs[1].node[1] == [('diamond', 'q')]
    assert l.Graphs[0].node[1] == [('box', 'p')]
Example #3
0
def test_graph_form4():
    l.Graphs = []
    Sets = []
    formulas_in = {}
    formulas_in[1] = []
    G = nx.MultiDiGraph()
    str_psi = "(Bp > (Dq ^ Bt))"
    psi = syntax.parse_formula(SET, str_psi)
    Sets.append(sols.recursivealpha(psi))
    gr.create_graph_K(G,Sets)
    l.Graphs.append(G)
    #apply beta expansion
    l.beta_node_solve(G, 1 ,formulas_in)
    l.delta_node_solve(l.Graphs[0],1,formulas_in)
    l.delta_node_solve(l.Graphs[1],1,formulas_in)
    #check if there are 2 graphs
    assert len(l.Graphs) == 2
    #check node 1 of graph 1 and graph 2
    assert l.Graphs[0].node[1] == [('not',('box', 'p'))]
    assert l.Graphs[1].node[1] == [('diamond', 'q'),('box','t')]
    #check node 2 of graph 1
    assert l.Graphs[0].node[2] == [('not', 'p')]
    #check node 2 of graph 2
    assert l.Graphs[1].node[2] == ['q','t']