def Q3_2(): clear() A = Var("A") B = Var("B") p1 = premise(Or(A, B)) p2 = premise(Not(B)) return orE(p1, Arrow(A,A), arrowI(assume(B), FE(notE(assumed(B), p2, false()), A), Arrow(B, A)), A)
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)"))
def Q3_3(): clear() A = Var("A") B = Var("B") p1 = premise(Or(Not(A), Not(B))) end = Not(And(A,B)) A_B = And(A,B) 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)
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)
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)
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)"))
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
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)")))
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)))
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)