Beispiel #1
0
def orComm():
    A = Var("a")
    B = Var("b")
    p1 = premise(Or(A, B))

    return orE(
        p1, arrowI(assume(A), orIR(assumed(A), Or(B, A)), Arrow(A, Or(B, A))),
        arrowI(assume(B), orIL(assumed(B), Or(B, A)), Arrow(B, Or(B, A))),
        Or(B, A))
Beispiel #2
0
def disSyl():
    A = Var("a")
    B = Var("b")
    p1 = premise(Or(A, B))
    p2 = premise(Not(B))

    return orE(
        p1, arrowI(assume(A), assumed(A), Arrow(A, A)),
        arrowI(assume(B), FE(notE(assumed(B), p2, false()), A), Arrow(B, A)),
        A)
Beispiel #3
0
def contra():
    return arrowI(
        assume(parse("EX x. P(x)")),
        arrowE(
            existsE(
                assumed(parse("EX x. P(x)")), "a",
                arrowI(assume(parse("P(a)")), assumed(parse("P(a)")),
                       Arrow(parse("P(a)"), parse("P(a)"))), parse("P(a)")),
            forallE(premise(parse("FA x. (P(x)->Q)")), "a", parse("P(a)->Q")),
            Var("Q")), Arrow(parse("EX x. P(x)"), Var("Q")))
Beispiel #4
0
def doubleNeg(p, a):
    l1 = LEM(Or(a, Not(a)))
    l2 = assume(a)
    l3 = assumed(a)
    l4 = arrowI(l2, l3, Arrow(a, a))
    l5 = assume(Not(a))
    l6 = assumed(Not(a))
    l7 = notE(l6, p, false())
    l8 = FE(l7, a)
    l9 = arrowI(l5, l8, Arrow(Not(a), a))
    l10 = orE(l1, l4, l9, a)
    return l10
Beispiel #5
0
def DM2():
    return notI(
        arrowI(
            assume(parse("FA x. P(x)")),
            notE(
                forallE(assumed(parse("FA x. P(x)")), "a", parse("P(a)")),
                existsE(
                    premise(parse("EX x. ~P(x)")), "a",
                    arrowI(assume(Not(parse("P(a)"))),
                           assumed(Not(parse("P(a)"))),
                           Arrow(Not(parse("P(a)")), Not(parse("P(a)")))),
                    Not(parse("P(a)"))), false()),
            (Arrow(parse("FA x. P(x)"), false()))), Not(parse("FA x. P(x)")))
Beispiel #6
0
def arrTrans():
    a = Var("A")
    b = Var("B")
    c = Var("C")

    p1 = premise(Arrow(a, b))
    p2 = premise(Arrow(b, c))

    a1 = assume(a)

    return arrowI(a1, \
                  arrowE(arrowE(assumed(a), \
                                p1, \
                                b), \
                         p2, \
                         c), \
                  Arrow(a,c))
Beispiel #7
0
def DL2(p1):
    a = Var("a")
    b = Var("b")

    return doubleNeg(
        notI(
            arrowI(
                assume(Not(b)),
                notE(orIR(assumed(Not(b)), Or(Not(a), Not(b))), p1, false()),
                Arrow(Not(b), false())), Not(Not(b))), b)
Beispiel #8
0
def DM3():
    return forallI(
        assume(Var("a")),
        notI(
            arrowI(
                assume(parse("P(a)")),
                notE(existsI(assumed(parse("P(a)")), "a", parse("EX x. P(x)")),
                     premise(Not(parse("EX x. P(x)"))), false()),
                Arrow(parse("P(a)"), false())), Not(parse("P(a)"))),
        parse("FA x. ~P(x)"))
Beispiel #9
0
def arrow_expr(tokens):
    follow = [TType.TEOF, TType.TRPAREN]
    lhs = or_expr(tokens)
    if tokens[0].ttype == TType.TARROW:
        tokens.pop(0)
        rhs = arrow_expr(tokens)
        lhs = Arrow(lhs, rhs)
    if tokens[0].ttype not in follow:
        raise ParseException(tokens[0].pos, follow, tokens[0].val)
    return lhs
Beispiel #10
0
def DM2():
    a = Var("a")
    b = Var("b")
    prem = premise(Not(And(a, b)))  #The original premise, ~(A && B)
    d1 = premise(
        Not(Or(Not(a), Not(b)))
    )  #d1 is the phrase required to run DL1 and DL2. I ran it as a premise, but it is assumed, NOT a premise

    return doubleNeg(
        notI(
            arrowI(assume(Not(Or(Not(a), Not(b)))),
                   notE(andI(DL1(d1), DL2(d1), And(a, b)), prem, false()),
                   Arrow(Not(Or(Not(a), Not(b))), false())),
            Not(Not(Or(Not(a), Not(b))))), Or(Not(a), Not(b)))
Beispiel #11
0
def DM1():
    A = Var("a")
    B = Var("b")
    p1 = premise(Or(Not(A), Not(B)))
    end = Not(And(A, B))
    A_B = And(A, B)
    #I condensed parts of the proofs so I could substitute in things that made sense to me, otherwise I was going nuts

    return orE(
        p1,
        arrowI(
            assume(Not(A)),
            notI(
                arrowI(assume(A_B),
                       notE(andEL(assumed(A_B), A), assumed(Not(A)), false()),
                       Arrow(A_B, false())), Not(A_B)),
            Arrow(Not(A), Not(A_B))),
        arrowI(
            assume(Not(B)),
            notI(
                arrowI(assume(A_B),
                       notE(andER(assumed(A_B), B), assumed(Not(B)), false()),
                       Arrow(A_B, false())), Not(A_B)),
            Arrow(Not(B), Not(A_B))), end)
Beispiel #12
0
def DM2():
    return notI(
        arrowI(
            assume(parse("FA x. P(x)")),
            notE(
                forallE(assumed(parse("FA x. P(x)")), "c", parse("P(c)")),
                existsE(
                    premise(parse("EX x. ~P(x)")), "d",
                    arrowI(
                        assume(parse("~P(d)")),
                        FE(
                            notE(
                                forallE(assumed(parse("FA x. P(x)")), "d",
                                        parse("P(d)")),
                                assumed(parse("~P(d)")), false()),
                            parse("~P(c)")), parse("~P(d) -> ~P(c)")),
                    parse("~P(c)")), false()),
            Arrow(parse("FA x. P(x)"), false())), parse("~FA x. P(x)"))