示例#1
0
    def test_with_two_hypotheses(self):
        t = z3.And(True)
        f = z3.And(False)
        a = z3.Int('a')
        p = (a * a == 4)
        r = (a == -2)
        s = (a == 2)

        assert causality_analyzer.explains_statement(t, p, r)
        assert is_candidate_inference(t, p, r)
        assert is_candidate_inference(t, p, s)
示例#2
0
    def test_with_two_hypotheses(self):
        t = z3.And(True)
        f = z3.And(False)
        a = z3.Int('a')
        p = (a * a == 4)
        r = (a == -2)
        s = (a == 2)

        assert causality_analyzer.explains_statement(t, p, r)
        assert is_candidate_inference(t, p, r)
        assert is_candidate_inference(t, p, s)
示例#3
0
    def test_with_two_hypotheses_extra(self):
        t = z3.And(True)
        f = z3.And(False)
        a = z3.Int('a')
        p = (a * a == 4)
        r = (a == -2)
        s = (a == 2)

        assert causality_analyzer.isnt_straight_up_false(t, p, r)
        assert causality_analyzer.isnt_vacuously_true(t, p, r)
        assert not is_candidate_inference(t, p, p)
        assert not is_candidate_inference(t, p, t)
        assert not is_candidate_inference(t, p, f)
        assert not is_candidate_unique_inference(t, p, r)
        assert not is_candidate_unique_inference(t, p, s)
示例#4
0
    def test_with_two_hypotheses_extra(self):
        t = z3.And(True)
        f = z3.And(False)
        a = z3.Int('a')
        p = (a * a == 4)
        r = (a == -2)
        s = (a == 2)

        assert causality_analyzer.isnt_straight_up_false(t, p, r)
        assert causality_analyzer.isnt_vacuously_true(t, p, r)
        assert not is_candidate_inference(t, p, p)
        assert not is_candidate_inference(t, p, t)
        assert not is_candidate_inference(t, p, f)
        assert not is_candidate_unique_inference(t, p, r)
        assert not is_candidate_unique_inference(t, p, s)
示例#5
0
    def test_with_booleans(self):
        t = z3.And(True)
        f = z3.And(False)

        assert not is_candidate_inference(t, t, t)
        assert not is_candidate_inference(t, t, f)
        assert not is_candidate_inference(t, f, t)
        assert not is_candidate_inference(t, f, f)
        assert not is_candidate_inference(f, t, t)
        assert not is_candidate_inference(f, t, t)
        assert not is_candidate_inference(f, f, t)
        assert not is_candidate_inference(f, f, f)
示例#6
0
    def test_with_booleans(self):
        t = z3.And(True)
        f = z3.And(False)

        assert not is_candidate_inference(t, t, t)
        assert not is_candidate_inference(t, t, f)
        assert not is_candidate_inference(t, f, t)
        assert not is_candidate_inference(t, f, f)
        assert not is_candidate_inference(f, t, t)
        assert not is_candidate_inference(f, t, t)
        assert not is_candidate_inference(f, f, t)
        assert not is_candidate_inference(f, f, f)