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 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 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)
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)"))